From f57e1ba8d2473e90b104c390601708be053f5f03 Mon Sep 17 00:00:00 2001 From: CookiePieWw Date: Fri, 30 Aug 2024 22:46:15 +0800 Subject: [PATCH] feat: add type extension for json type --- c++/greptime/v1/common.pb.cc | 85 +++++--- c++/greptime/v1/common.pb.h | 55 ++++++ go/greptime/v1/common.pb.go | 32 ++- java/src/main/java/io/greptime/v1/Common.java | 184 +++++++++++++++--- proto/greptime/v1/common.proto | 6 +- 5 files changed, 305 insertions(+), 57 deletions(-) diff --git a/c++/greptime/v1/common.pb.cc b/c++/greptime/v1/common.pb.cc index d8b73511..aeacf617 100644 --- a/c++/greptime/v1/common.pb.cc +++ b/c++/greptime/v1/common.pb.cc @@ -447,6 +447,7 @@ const uint32_t TableStruct_greptime_2fv1_2fcommon_2eproto::offsets[] PROTOBUF_SE ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ ::_pbi::kInvalidFieldOffsetTag, + ::_pbi::kInvalidFieldOffsetTag, PROTOBUF_FIELD_OFFSET(::greptime::v1::ColumnDataTypeExtension, _impl_.type_ext_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::greptime::v1::DecimalTypeExtension, _internal_metadata_), @@ -492,9 +493,9 @@ static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protode { 120, -1, -1, sizeof(::greptime::v1::IntervalMonthDayNano)}, { 129, -1, -1, sizeof(::greptime::v1::Decimal128)}, { 137, -1, -1, sizeof(::greptime::v1::ColumnDataTypeExtension)}, - { 145, -1, -1, sizeof(::greptime::v1::DecimalTypeExtension)}, - { 153, 161, -1, sizeof(::greptime::v1::ColumnOptions_OptionsEntry_DoNotUse)}, - { 163, -1, -1, sizeof(::greptime::v1::ColumnOptions)}, + { 146, -1, -1, sizeof(::greptime::v1::DecimalTypeExtension)}, + { 154, 162, -1, sizeof(::greptime::v1::ColumnOptions_OptionsEntry_DoNotUse)}, + { 164, -1, -1, sizeof(::greptime::v1::ColumnOptions)}, }; static const ::_pb::Message* const file_default_instances[] = { @@ -550,33 +551,34 @@ const char descriptor_table_protodef_greptime_2fv1_2fcommon_2eproto[] PROTOBUF_S "2\024.greptime.v1.Metrics\"I\n\024IntervalMonthD" "ayNano\022\016\n\006months\030\001 \001(\005\022\014\n\004days\030\002 \001(\005\022\023\n\013" "nanoseconds\030\003 \001(\003\"$\n\nDecimal128\022\n\n\002hi\030\001 " - "\001(\003\022\n\n\002lo\030\002 \001(\003\"`\n\027ColumnDataTypeExtensi" + "\001(\003\022\n\n\002lo\030\002 \001(\003\"u\n\027ColumnDataTypeExtensi" "on\0229\n\014decimal_type\030\001 \001(\0132!.greptime.v1.D" - "ecimalTypeExtensionH\000B\n\n\010type_ext\"8\n\024Dec" - "imalTypeExtension\022\021\n\tprecision\030\001 \001(\005\022\r\n\005" - "scale\030\002 \001(\005\"y\n\rColumnOptions\0228\n\007options\030" - "\001 \003(\0132\'.greptime.v1.ColumnOptions.Option" - "sEntry\032.\n\014OptionsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005v" - "alue\030\002 \001(\t:\0028\001*1\n\014SemanticType\022\007\n\003TAG\020\000\022" - "\t\n\005FIELD\020\001\022\r\n\tTIMESTAMP\020\002*\326\003\n\016ColumnData" - "Type\022\013\n\007BOOLEAN\020\000\022\010\n\004INT8\020\001\022\t\n\005INT16\020\002\022\t" - "\n\005INT32\020\003\022\t\n\005INT64\020\004\022\t\n\005UINT8\020\005\022\n\n\006UINT1" - "6\020\006\022\n\n\006UINT32\020\007\022\n\n\006UINT64\020\010\022\013\n\007FLOAT32\020\t" - "\022\013\n\007FLOAT64\020\n\022\n\n\006BINARY\020\013\022\n\n\006STRING\020\014\022\010\n" - "\004DATE\020\r\022\014\n\010DATETIME\020\016\022\024\n\020TIMESTAMP_SECON" - "D\020\017\022\031\n\025TIMESTAMP_MILLISECOND\020\020\022\031\n\025TIMEST" - "AMP_MICROSECOND\020\021\022\030\n\024TIMESTAMP_NANOSECON" - "D\020\022\022\017\n\013TIME_SECOND\020\023\022\024\n\020TIME_MILLISECOND" - "\020\024\022\024\n\020TIME_MICROSECOND\020\025\022\023\n\017TIME_NANOSEC" - "OND\020\026\022\027\n\023INTERVAL_YEAR_MONTH\020\027\022\025\n\021INTERV" - "AL_DAY_TIME\020\030\022\033\n\027INTERVAL_MONTH_DAY_NANO" - "\020\031\022\016\n\nDECIMAL128\020\036BO\n\016io.greptime.v1B\006Co" - "mmonZ5github.com/GreptimeTeam/greptime-p" - "roto/go/greptime/v1b\006proto3" + "ecimalTypeExtensionH\000\022\023\n\tjson_type\030\002 \001(\010" + "H\000B\n\n\010type_ext\"8\n\024DecimalTypeExtension\022\021" + "\n\tprecision\030\001 \001(\005\022\r\n\005scale\030\002 \001(\005\"y\n\rColu" + "mnOptions\0228\n\007options\030\001 \003(\0132\'.greptime.v1" + ".ColumnOptions.OptionsEntry\032.\n\014OptionsEn" + "try\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001*1\n\014S" + "emanticType\022\007\n\003TAG\020\000\022\t\n\005FIELD\020\001\022\r\n\tTIMES" + "TAMP\020\002*\326\003\n\016ColumnDataType\022\013\n\007BOOLEAN\020\000\022\010" + "\n\004INT8\020\001\022\t\n\005INT16\020\002\022\t\n\005INT32\020\003\022\t\n\005INT64\020" + "\004\022\t\n\005UINT8\020\005\022\n\n\006UINT16\020\006\022\n\n\006UINT32\020\007\022\n\n\006" + "UINT64\020\010\022\013\n\007FLOAT32\020\t\022\013\n\007FLOAT64\020\n\022\n\n\006BI" + "NARY\020\013\022\n\n\006STRING\020\014\022\010\n\004DATE\020\r\022\014\n\010DATETIME" + "\020\016\022\024\n\020TIMESTAMP_SECOND\020\017\022\031\n\025TIMESTAMP_MI" + "LLISECOND\020\020\022\031\n\025TIMESTAMP_MICROSECOND\020\021\022\030" + "\n\024TIMESTAMP_NANOSECOND\020\022\022\017\n\013TIME_SECOND\020" + "\023\022\024\n\020TIME_MILLISECOND\020\024\022\024\n\020TIME_MICROSEC" + "OND\020\025\022\023\n\017TIME_NANOSECOND\020\026\022\027\n\023INTERVAL_Y" + "EAR_MONTH\020\027\022\025\n\021INTERVAL_DAY_TIME\020\030\022\033\n\027IN" + "TERVAL_MONTH_DAY_NANO\020\031\022\016\n\nDECIMAL128\020\036B" + "O\n\016io.greptime.v1B\006CommonZ5github.com/Gr" + "eptimeTeam/greptime-proto/go/greptime/v1" + "b\006proto3" ; static ::_pbi::once_flag descriptor_table_greptime_2fv1_2fcommon_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_greptime_2fv1_2fcommon_2eproto = { - false, false, 2067, descriptor_table_protodef_greptime_2fv1_2fcommon_2eproto, + false, false, 2088, descriptor_table_protodef_greptime_2fv1_2fcommon_2eproto, "greptime/v1/common.proto", &descriptor_table_greptime_2fv1_2fcommon_2eproto_once, nullptr, 0, 20, schemas, file_default_instances, TableStruct_greptime_2fv1_2fcommon_2eproto::offsets, @@ -4309,6 +4311,10 @@ ColumnDataTypeExtension::ColumnDataTypeExtension(const ColumnDataTypeExtension& from._internal_decimal_type()); break; } + case kJsonType: { + _this->_internal_set_json_type(from._internal_json_type()); + break; + } case TYPE_EXT_NOT_SET: { break; } @@ -4357,6 +4363,10 @@ void ColumnDataTypeExtension::clear_type_ext() { } break; } + case kJsonType: { + // No need to clear + break; + } case TYPE_EXT_NOT_SET: { break; } @@ -4389,6 +4399,14 @@ const char* ColumnDataTypeExtension::_InternalParse(const char* ptr, ::_pbi::Par } else goto handle_unusual; continue; + // bool json_type = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _internal_set_json_type(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr)); + CHK_(ptr); + } else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -4425,6 +4443,12 @@ uint8_t* ColumnDataTypeExtension::_InternalSerialize( _Internal::decimal_type(this).GetCachedSize(), target, stream); } + // bool json_type = 2; + if (_internal_has_json_type()) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray(2, this->_internal_json_type(), target); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); @@ -4449,6 +4473,11 @@ size_t ColumnDataTypeExtension::ByteSizeLong() const { *_impl_.type_ext_.decimal_type_); break; } + // bool json_type = 2; + case kJsonType: { + total_size += 1 + 1; + break; + } case TYPE_EXT_NOT_SET: { break; } @@ -4477,6 +4506,10 @@ void ColumnDataTypeExtension::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg from._internal_decimal_type()); break; } + case kJsonType: { + _this->_internal_set_json_type(from._internal_json_type()); + break; + } case TYPE_EXT_NOT_SET: { break; } diff --git a/c++/greptime/v1/common.pb.h b/c++/greptime/v1/common.pb.h index ded265d5..23d04673 100644 --- a/c++/greptime/v1/common.pb.h +++ b/c++/greptime/v1/common.pb.h @@ -2764,6 +2764,7 @@ class ColumnDataTypeExtension final : } enum TypeExtCase { kDecimalType = 1, + kJsonType = 2, TYPE_EXT_NOT_SET = 0, }; @@ -2846,6 +2847,7 @@ class ColumnDataTypeExtension final : enum : int { kDecimalTypeFieldNumber = 1, + kJsonTypeFieldNumber = 2, }; // .greptime.v1.DecimalTypeExtension decimal_type = 1; bool has_decimal_type() const; @@ -2865,12 +2867,26 @@ class ColumnDataTypeExtension final : ::greptime::v1::DecimalTypeExtension* decimal_type); ::greptime::v1::DecimalTypeExtension* unsafe_arena_release_decimal_type(); + // bool json_type = 2; + bool has_json_type() const; + private: + bool _internal_has_json_type() const; + public: + void clear_json_type(); + bool json_type() const; + void set_json_type(bool value); + private: + bool _internal_json_type() const; + void _internal_set_json_type(bool value); + public: + void clear_type_ext(); TypeExtCase type_ext_case() const; // @@protoc_insertion_point(class_scope:greptime.v1.ColumnDataTypeExtension) private: class _Internal; void set_has_decimal_type(); + void set_has_json_type(); inline bool has_type_ext() const; inline void clear_has_type_ext(); @@ -2883,6 +2899,7 @@ class ColumnDataTypeExtension final : constexpr TypeExtUnion() : _constinit_{} {} ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized _constinit_; ::greptime::v1::DecimalTypeExtension* decimal_type_; + bool json_type_; } type_ext_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; uint32_t _oneof_case_[1]; @@ -4891,6 +4908,44 @@ inline ::greptime::v1::DecimalTypeExtension* ColumnDataTypeExtension::mutable_de return _msg; } +// bool json_type = 2; +inline bool ColumnDataTypeExtension::_internal_has_json_type() const { + return type_ext_case() == kJsonType; +} +inline bool ColumnDataTypeExtension::has_json_type() const { + return _internal_has_json_type(); +} +inline void ColumnDataTypeExtension::set_has_json_type() { + _impl_._oneof_case_[0] = kJsonType; +} +inline void ColumnDataTypeExtension::clear_json_type() { + if (_internal_has_json_type()) { + _impl_.type_ext_.json_type_ = false; + clear_has_type_ext(); + } +} +inline bool ColumnDataTypeExtension::_internal_json_type() const { + if (_internal_has_json_type()) { + return _impl_.type_ext_.json_type_; + } + return false; +} +inline void ColumnDataTypeExtension::_internal_set_json_type(bool value) { + if (!_internal_has_json_type()) { + clear_type_ext(); + set_has_json_type(); + } + _impl_.type_ext_.json_type_ = value; +} +inline bool ColumnDataTypeExtension::json_type() const { + // @@protoc_insertion_point(field_get:greptime.v1.ColumnDataTypeExtension.json_type) + return _internal_json_type(); +} +inline void ColumnDataTypeExtension::set_json_type(bool value) { + _internal_set_json_type(value); + // @@protoc_insertion_point(field_set:greptime.v1.ColumnDataTypeExtension.json_type) +} + inline bool ColumnDataTypeExtension::has_type_ext() const { return type_ext_case() != TYPE_EXT_NOT_SET; } diff --git a/go/greptime/v1/common.pb.go b/go/greptime/v1/common.pb.go index 3dd34491..12c5047f 100644 --- a/go/greptime/v1/common.pb.go +++ b/go/greptime/v1/common.pb.go @@ -1050,6 +1050,7 @@ type ColumnDataTypeExtension struct { // Types that are assignable to TypeExt: // // *ColumnDataTypeExtension_DecimalType + // *ColumnDataTypeExtension_JsonType TypeExt isColumnDataTypeExtension_TypeExt `protobuf_oneof:"type_ext"` } @@ -1099,6 +1100,13 @@ func (x *ColumnDataTypeExtension) GetDecimalType() *DecimalTypeExtension { return nil } +func (x *ColumnDataTypeExtension) GetJsonType() bool { + if x, ok := x.GetTypeExt().(*ColumnDataTypeExtension_JsonType); ok { + return x.JsonType + } + return false +} + type isColumnDataTypeExtension_TypeExt interface { isColumnDataTypeExtension_TypeExt() } @@ -1107,8 +1115,15 @@ type ColumnDataTypeExtension_DecimalType struct { DecimalType *DecimalTypeExtension `protobuf:"bytes,1,opt,name=decimal_type,json=decimalType,proto3,oneof"` } +type ColumnDataTypeExtension_JsonType struct { + // Marks the binary column in proto is actually a JSON column. + JsonType bool `protobuf:"varint,2,opt,name=json_type,json=jsonType,proto3,oneof"` +} + func (*ColumnDataTypeExtension_DecimalType) isColumnDataTypeExtension_TypeExt() {} +func (*ColumnDataTypeExtension_JsonType) isColumnDataTypeExtension_TypeExt() {} + type DecimalTypeExtension struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1329,13 +1344,15 @@ var file_greptime_v1_common_proto_rawDesc = []byte{ 0x0b, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x2c, 0x0a, 0x0a, 0x44, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x31, 0x32, 0x38, 0x12, 0x0e, 0x0a, 0x02, 0x68, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x68, 0x69, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x6f, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x6c, 0x6f, 0x22, 0x6d, 0x0a, 0x17, 0x43, 0x6f, - 0x6c, 0x75, 0x6d, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x54, 0x79, 0x70, 0x65, 0x45, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x46, 0x0a, 0x0c, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x72, - 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x63, 0x69, 0x6d, 0x61, - 0x6c, 0x54, 0x79, 0x70, 0x65, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, - 0x52, 0x0b, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x42, 0x0a, 0x0a, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x6c, 0x6f, 0x22, 0x8c, 0x01, 0x0a, 0x17, 0x43, + 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x54, 0x79, 0x70, 0x65, 0x45, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x46, 0x0a, 0x0c, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, + 0x6c, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, + 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x63, 0x69, 0x6d, + 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, + 0x00, 0x52, 0x0b, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, + 0x0a, 0x09, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x08, 0x48, 0x00, 0x52, 0x08, 0x6a, 0x73, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x42, 0x0a, 0x0a, 0x08, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x65, 0x78, 0x74, 0x22, 0x4a, 0x0a, 0x14, 0x44, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, @@ -1664,6 +1681,7 @@ func file_greptime_v1_common_proto_init() { } file_greptime_v1_common_proto_msgTypes[14].OneofWrappers = []interface{}{ (*ColumnDataTypeExtension_DecimalType)(nil), + (*ColumnDataTypeExtension_JsonType)(nil), } type x struct{} out := protoimpl.TypeBuilder{ diff --git a/java/src/main/java/io/greptime/v1/Common.java b/java/src/main/java/io/greptime/v1/Common.java index c45dee34..65ee888c 100644 --- a/java/src/main/java/io/greptime/v1/Common.java +++ b/java/src/main/java/io/greptime/v1/Common.java @@ -11476,6 +11476,25 @@ public interface ColumnDataTypeExtensionOrBuilder extends */ io.greptime.v1.Common.DecimalTypeExtensionOrBuilder getDecimalTypeOrBuilder(); + /** + *
+     * Marks the binary column in proto is actually a JSON column.
+     * 
+ * + * bool json_type = 2; + * @return Whether the jsonType field is set. + */ + boolean hasJsonType(); + /** + *
+     * Marks the binary column in proto is actually a JSON column.
+     * 
+ * + * bool json_type = 2; + * @return The jsonType. + */ + boolean getJsonType(); + public io.greptime.v1.Common.ColumnDataTypeExtension.TypeExtCase getTypeExtCase(); } /** @@ -11541,6 +11560,11 @@ private ColumnDataTypeExtension( typeExtCase_ = 1; break; } + case 16: { + typeExt_ = input.readBool(); + typeExtCase_ = 2; + break; + } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { @@ -11581,6 +11605,7 @@ public enum TypeExtCase implements com.google.protobuf.Internal.EnumLite, com.google.protobuf.AbstractMessage.InternalOneOfEnum { DECIMAL_TYPE(1), + JSON_TYPE(2), TYPEEXT_NOT_SET(0); private final int value; private TypeExtCase(int value) { @@ -11599,6 +11624,7 @@ public static TypeExtCase valueOf(int value) { public static TypeExtCase forNumber(int value) { switch (value) { case 1: return DECIMAL_TYPE; + case 2: return JSON_TYPE; case 0: return TYPEEXT_NOT_SET; default: return null; } @@ -11645,6 +11671,35 @@ public io.greptime.v1.Common.DecimalTypeExtensionOrBuilder getDecimalTypeOrBuild return io.greptime.v1.Common.DecimalTypeExtension.getDefaultInstance(); } + public static final int JSON_TYPE_FIELD_NUMBER = 2; + /** + *
+     * Marks the binary column in proto is actually a JSON column.
+     * 
+ * + * bool json_type = 2; + * @return Whether the jsonType field is set. + */ + @java.lang.Override + public boolean hasJsonType() { + return typeExtCase_ == 2; + } + /** + *
+     * Marks the binary column in proto is actually a JSON column.
+     * 
+ * + * bool json_type = 2; + * @return The jsonType. + */ + @java.lang.Override + public boolean getJsonType() { + if (typeExtCase_ == 2) { + return (java.lang.Boolean) typeExt_; + } + return false; + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -11662,6 +11717,10 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (typeExtCase_ == 1) { output.writeMessage(1, (io.greptime.v1.Common.DecimalTypeExtension) typeExt_); } + if (typeExtCase_ == 2) { + output.writeBool( + 2, (boolean)((java.lang.Boolean) typeExt_)); + } unknownFields.writeTo(output); } @@ -11675,6 +11734,11 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, (io.greptime.v1.Common.DecimalTypeExtension) typeExt_); } + if (typeExtCase_ == 2) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize( + 2, (boolean)((java.lang.Boolean) typeExt_)); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -11696,6 +11760,10 @@ public boolean equals(final java.lang.Object obj) { if (!getDecimalType() .equals(other.getDecimalType())) return false; break; + case 2: + if (getJsonType() + != other.getJsonType()) return false; + break; case 0: default: } @@ -11715,6 +11783,11 @@ public int hashCode() { hash = (37 * hash) + DECIMAL_TYPE_FIELD_NUMBER; hash = (53 * hash) + getDecimalType().hashCode(); break; + case 2: + hash = (37 * hash) + JSON_TYPE_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getJsonType()); + break; case 0: default: } @@ -11890,6 +11963,9 @@ public io.greptime.v1.Common.ColumnDataTypeExtension buildPartial() { result.typeExt_ = decimalTypeBuilder_.build(); } } + if (typeExtCase_ == 2) { + result.typeExt_ = typeExt_; + } result.typeExtCase_ = typeExtCase_; onBuilt(); return result; @@ -11944,6 +12020,10 @@ public Builder mergeFrom(io.greptime.v1.Common.ColumnDataTypeExtension other) { mergeDecimalType(other.getDecimalType()); break; } + case JSON_TYPE: { + setJsonType(other.getJsonType()); + break; + } case TYPEEXT_NOT_SET: { break; } @@ -12133,6 +12213,63 @@ public io.greptime.v1.Common.DecimalTypeExtensionOrBuilder getDecimalTypeOrBuild onChanged();; return decimalTypeBuilder_; } + + /** + *
+       * Marks the binary column in proto is actually a JSON column.
+       * 
+ * + * bool json_type = 2; + * @return Whether the jsonType field is set. + */ + public boolean hasJsonType() { + return typeExtCase_ == 2; + } + /** + *
+       * Marks the binary column in proto is actually a JSON column.
+       * 
+ * + * bool json_type = 2; + * @return The jsonType. + */ + public boolean getJsonType() { + if (typeExtCase_ == 2) { + return (java.lang.Boolean) typeExt_; + } + return false; + } + /** + *
+       * Marks the binary column in proto is actually a JSON column.
+       * 
+ * + * bool json_type = 2; + * @param value The jsonType to set. + * @return This builder for chaining. + */ + public Builder setJsonType(boolean value) { + typeExtCase_ = 2; + typeExt_ = value; + onChanged(); + return this; + } + /** + *
+       * Marks the binary column in proto is actually a JSON column.
+       * 
+ * + * bool json_type = 2; + * @return This builder for chaining. + */ + public Builder clearJsonType() { + if (typeExtCase_ == 2) { + typeExtCase_ = 0; + typeExt_ = null; + onChanged(); + } + return this; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { @@ -13925,29 +14062,30 @@ public io.greptime.v1.Common.ColumnOptions getDefaultInstanceForType() { "2\024.greptime.v1.Metrics\"I\n\024IntervalMonthD" + "ayNano\022\016\n\006months\030\001 \001(\005\022\014\n\004days\030\002 \001(\005\022\023\n\013" + "nanoseconds\030\003 \001(\003\"$\n\nDecimal128\022\n\n\002hi\030\001 " + - "\001(\003\022\n\n\002lo\030\002 \001(\003\"`\n\027ColumnDataTypeExtensi" + + "\001(\003\022\n\n\002lo\030\002 \001(\003\"u\n\027ColumnDataTypeExtensi" + "on\0229\n\014decimal_type\030\001 \001(\0132!.greptime.v1.D" + - "ecimalTypeExtensionH\000B\n\n\010type_ext\"8\n\024Dec" + - "imalTypeExtension\022\021\n\tprecision\030\001 \001(\005\022\r\n\005" + - "scale\030\002 \001(\005\"y\n\rColumnOptions\0228\n\007options\030" + - "\001 \003(\0132\'.greptime.v1.ColumnOptions.Option" + - "sEntry\032.\n\014OptionsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005v" + - "alue\030\002 \001(\t:\0028\001*1\n\014SemanticType\022\007\n\003TAG\020\000\022" + - "\t\n\005FIELD\020\001\022\r\n\tTIMESTAMP\020\002*\326\003\n\016ColumnData" + - "Type\022\013\n\007BOOLEAN\020\000\022\010\n\004INT8\020\001\022\t\n\005INT16\020\002\022\t" + - "\n\005INT32\020\003\022\t\n\005INT64\020\004\022\t\n\005UINT8\020\005\022\n\n\006UINT1" + - "6\020\006\022\n\n\006UINT32\020\007\022\n\n\006UINT64\020\010\022\013\n\007FLOAT32\020\t" + - "\022\013\n\007FLOAT64\020\n\022\n\n\006BINARY\020\013\022\n\n\006STRING\020\014\022\010\n" + - "\004DATE\020\r\022\014\n\010DATETIME\020\016\022\024\n\020TIMESTAMP_SECON" + - "D\020\017\022\031\n\025TIMESTAMP_MILLISECOND\020\020\022\031\n\025TIMEST" + - "AMP_MICROSECOND\020\021\022\030\n\024TIMESTAMP_NANOSECON" + - "D\020\022\022\017\n\013TIME_SECOND\020\023\022\024\n\020TIME_MILLISECOND" + - "\020\024\022\024\n\020TIME_MICROSECOND\020\025\022\023\n\017TIME_NANOSEC" + - "OND\020\026\022\027\n\023INTERVAL_YEAR_MONTH\020\027\022\025\n\021INTERV" + - "AL_DAY_TIME\020\030\022\033\n\027INTERVAL_MONTH_DAY_NANO" + - "\020\031\022\016\n\nDECIMAL128\020\036BO\n\016io.greptime.v1B\006Co" + - "mmonZ5github.com/GreptimeTeam/greptime-p" + - "roto/go/greptime/v1b\006proto3" + "ecimalTypeExtensionH\000\022\023\n\tjson_type\030\002 \001(\010" + + "H\000B\n\n\010type_ext\"8\n\024DecimalTypeExtension\022\021" + + "\n\tprecision\030\001 \001(\005\022\r\n\005scale\030\002 \001(\005\"y\n\rColu" + + "mnOptions\0228\n\007options\030\001 \003(\0132\'.greptime.v1" + + ".ColumnOptions.OptionsEntry\032.\n\014OptionsEn" + + "try\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001*1\n\014S" + + "emanticType\022\007\n\003TAG\020\000\022\t\n\005FIELD\020\001\022\r\n\tTIMES" + + "TAMP\020\002*\326\003\n\016ColumnDataType\022\013\n\007BOOLEAN\020\000\022\010" + + "\n\004INT8\020\001\022\t\n\005INT16\020\002\022\t\n\005INT32\020\003\022\t\n\005INT64\020" + + "\004\022\t\n\005UINT8\020\005\022\n\n\006UINT16\020\006\022\n\n\006UINT32\020\007\022\n\n\006" + + "UINT64\020\010\022\013\n\007FLOAT32\020\t\022\013\n\007FLOAT64\020\n\022\n\n\006BI" + + "NARY\020\013\022\n\n\006STRING\020\014\022\010\n\004DATE\020\r\022\014\n\010DATETIME" + + "\020\016\022\024\n\020TIMESTAMP_SECOND\020\017\022\031\n\025TIMESTAMP_MI" + + "LLISECOND\020\020\022\031\n\025TIMESTAMP_MICROSECOND\020\021\022\030" + + "\n\024TIMESTAMP_NANOSECOND\020\022\022\017\n\013TIME_SECOND\020" + + "\023\022\024\n\020TIME_MILLISECOND\020\024\022\024\n\020TIME_MICROSEC" + + "OND\020\025\022\023\n\017TIME_NANOSECOND\020\026\022\027\n\023INTERVAL_Y" + + "EAR_MONTH\020\027\022\025\n\021INTERVAL_DAY_TIME\020\030\022\033\n\027IN" + + "TERVAL_MONTH_DAY_NANO\020\031\022\016\n\nDECIMAL128\020\036B" + + "O\n\016io.greptime.v1B\006CommonZ5github.com/Gr" + + "eptimeTeam/greptime-proto/go/greptime/v1" + + "b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -14054,7 +14192,7 @@ public io.greptime.v1.Common.ColumnOptions getDefaultInstanceForType() { internal_static_greptime_v1_ColumnDataTypeExtension_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_greptime_v1_ColumnDataTypeExtension_descriptor, - new java.lang.String[] { "DecimalType", "TypeExt", }); + new java.lang.String[] { "DecimalType", "JsonType", "TypeExt", }); internal_static_greptime_v1_DecimalTypeExtension_descriptor = getDescriptor().getMessageTypes().get(15); internal_static_greptime_v1_DecimalTypeExtension_fieldAccessorTable = new diff --git a/proto/greptime/v1/common.proto b/proto/greptime/v1/common.proto index d56aa925..29b237eb 100644 --- a/proto/greptime/v1/common.proto +++ b/proto/greptime/v1/common.proto @@ -133,7 +133,11 @@ message Decimal128 { // Type extension for some complex types message ColumnDataTypeExtension { - oneof type_ext { DecimalTypeExtension decimal_type = 1; } + oneof type_ext { + DecimalTypeExtension decimal_type = 1; + // Marks the binary column in proto is actually a JSON column. + bool json_type = 2; + } } message DecimalTypeExtension {