From 45490b62933908ff72bd6b3dab062db0648f0760 Mon Sep 17 00:00:00 2001 From: fys <40801205+Fengys123@users.noreply.github.com> Date: Fri, 29 Jul 2022 11:11:23 +0800 Subject: [PATCH] select result proto definition (#118) --- src/api/greptime/v1/column.proto | 46 ++++++++++++++++++++++++++++++ src/api/greptime/v1/database.proto | 3 +- src/api/greptime/v1/greptime.proto | 1 + src/api/greptime/v1/insert.proto | 44 ++-------------------------- src/api/greptime/v1/select.proto | 10 +++++++ 5 files changed, 60 insertions(+), 44 deletions(-) create mode 100644 src/api/greptime/v1/column.proto create mode 100644 src/api/greptime/v1/select.proto diff --git a/src/api/greptime/v1/column.proto b/src/api/greptime/v1/column.proto new file mode 100644 index 0000000000..a66c7d2369 --- /dev/null +++ b/src/api/greptime/v1/column.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; + +package greptime.v1; + +message Column { + string column_name = 1; + + enum SemanticType { + TAG = 0; + FIELD = 1; + TIMESTAMP = 2; + } + SemanticType semantic_type = 2; + + message Values { + repeated int32 i8_values = 1; + repeated int32 i16_values = 2; + repeated int32 i32_values = 3; + repeated int64 i64_values = 4; + + repeated uint32 u8_values = 5; + repeated uint32 u16_values = 6; + repeated uint32 u32_values = 7; + repeated uint64 u64_values = 8; + + repeated float f32_values = 9; + repeated double f64_values = 10; + + repeated bool bool_values = 11; + repeated bytes binary_values = 12; + repeated string string_values = 13; + } + // The array of non-null values in this column. + // + // For example: suppose there is a column "foo" that contains some int32 values (1, 2, 3, 4, 5, null, 7, 8, 9, null); + // column: + // column_name: foo + // semantic_type: Tag + // values: 1, 2, 3, 4, 5, 7, 8, 9 + // null_masks: 00100000 00000010 + Values values = 3; + + // Mask maps the positions of null values. + // If a bit in null_mask is 1, it indicates that the column value at that position is null. + bytes null_mask = 4; +} diff --git a/src/api/greptime/v1/database.proto b/src/api/greptime/v1/database.proto index 674260ec69..eab9b15269 100644 --- a/src/api/greptime/v1/database.proto +++ b/src/api/greptime/v1/database.proto @@ -37,8 +37,7 @@ message DeleteExpr {} message ObjectResult { ResultHeader header = 1; - string schema = 2; - repeated bytes results = 3; + bytes results = 2; } message Header { diff --git a/src/api/greptime/v1/greptime.proto b/src/api/greptime/v1/greptime.proto index 9e9408a8a1..6310271709 100644 --- a/src/api/greptime/v1/greptime.proto +++ b/src/api/greptime/v1/greptime.proto @@ -5,6 +5,7 @@ package greptime.v1; import "greptime/v1/admin.proto"; import "greptime/v1/database.proto"; import "greptime/v1/insert.proto"; +import "greptime/v1/select.proto"; service Greptime { rpc Batch(BatchRequest) returns (BatchResponse) {} diff --git a/src/api/greptime/v1/insert.proto b/src/api/greptime/v1/insert.proto index 47ec9c52f5..9e9100b913 100644 --- a/src/api/greptime/v1/insert.proto +++ b/src/api/greptime/v1/insert.proto @@ -2,50 +2,10 @@ syntax = "proto3"; package greptime.v1; +import "greptime/v1/column.proto"; + message InsertBatch { repeated Column columns = 1; uint32 row_count = 2; } -message Column { - string column_name = 1; - - enum SemanticType { - TAG = 0; - FIELD = 1; - TIMESTAMP = 2; - } - SemanticType semantic_type = 2; - - message Values { - repeated int32 i8_values = 1; - repeated int32 i16_values = 2; - repeated int32 i32_values = 3; - repeated int64 i64_values = 4; - - repeated uint32 u8_values = 5; - repeated uint32 u16_values = 6; - repeated uint32 u32_values = 7; - repeated uint64 u64_values = 8; - - repeated float f32_values = 9; - repeated double f64_values = 10; - - repeated bool bool_values = 11; - repeated bytes binary_values = 12; - repeated string string_values = 13; - } - // The array of non-null values in this column. - // - // For example: suppose there is a column "foo" that contains some int32 values (1, 2, 3, 4, 5, null, 7, 8, 9, null); - // column: - // column_name: foo - // semantic_type: Tag - // values: 1, 2, 3, 4, 5, 7, 8, 9 - // null_masks: 00100000 00000010 - Values values = 3; - - // Mask maps the positions of null values. - // If a bit in null_mask is 1, it indicates that the column value at that position is null. - bytes null_mask = 4; -} diff --git a/src/api/greptime/v1/select.proto b/src/api/greptime/v1/select.proto new file mode 100644 index 0000000000..ab0e526faf --- /dev/null +++ b/src/api/greptime/v1/select.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +package greptime.v1; + +import "greptime/v1/column.proto"; + +message SelectResult { + repeated Column columns = 1; + uint32 row_count = 2; +}