Skip to content

Commit

Permalink
feat: decimal128 proto
Browse files Browse the repository at this point in the history
  • Loading branch information
QuenKar committed Nov 20, 2023
1 parent 2542930 commit 286ef16
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions proto/greptime/v1/column.proto
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ message Column {
repeated int64 duration_millisecond_values = 28;
repeated int64 duration_microsecond_values = 29;
repeated int64 duration_nanosecond_values = 30;
repeated Decimal128 decimal128_values = 31;
}
// The array of non-null values in this column.
//
Expand All @@ -80,4 +81,7 @@ message Column {

// Helpful in creating vector from column.
ColumnDataType datatype = 5;

// Extension for ColumnDataType.
ColumnDataTypeExtension datatype_extension = 6;
}
22 changes: 22 additions & 0 deletions proto/greptime/v1/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,32 @@ enum ColumnDataType {
DURATION_MILLISECOND = 27;
DURATION_MICROSECOND = 28;
DURATION_NANOSECOND = 29;
DECIMAL_128 = 30;
}

message IntervalMonthDayNano {
int32 months = 1;
int32 days = 2;
int64 nanoseconds = 3;
}

// (hi: high 64 bits, lo: low 64 bits, precision, scale) are used to
// construct the decimal128 value.
message Decimal128 {
int64 hi = 1;
int64 lo = 2;
int32 precision = 3;
int32 scale = 4;
}

// Type extension for some complex types
message ColumnDataTypeExtension{
oneof ext {
DecimalTypeExtension decimal_type = 1;
}
}

message DecimalTypeExtension {
int32 precision = 1;
int32 scale = 2;
}
2 changes: 2 additions & 0 deletions proto/greptime/v1/ddl.proto
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ message ColumnDef {
bytes default_constraint = 4;
SemanticType semantic_type = 5;
string comment = 6;
// Extension for ColumnDataType.
ColumnDataTypeExtension datatype_extension = 7;
}

message AddColumnLocation {
Expand Down
3 changes: 3 additions & 0 deletions proto/greptime/v1/row.proto
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ message ColumnSchema {
string column_name = 1;
ColumnDataType datatype = 2;
SemanticType semantic_type = 3;
// Extension for ColumnDataType.
ColumnDataTypeExtension datatype_extension = 4;
}

message Row { repeated Value values = 1; }
Expand Down Expand Up @@ -71,5 +73,6 @@ message Value {
int64 duration_millisecond_value = 28;
int64 duration_microsecond_value = 29;
int64 duration_nanosecond_value = 30;
Decimal128 decimal128_value = 31;
}
}

0 comments on commit 286ef16

Please sign in to comment.