feat: add "variant" type to json (#315)

* x

* x

* x
This commit is contained in:
LFC
2026-04-20 16:26:09 +08:00
committed by GitHub
parent 26a50f4069
commit 0de5437582
7 changed files with 306 additions and 43 deletions
+48 -12
View File
@@ -257,6 +257,7 @@ const uint32_t TableStruct_greptime_2fv1_2frow_2eproto::offsets[] PROTOBUF_SECTI
::_pbi::kInvalidFieldOffsetTag, ::_pbi::kInvalidFieldOffsetTag,
::_pbi::kInvalidFieldOffsetTag, ::_pbi::kInvalidFieldOffsetTag,
::_pbi::kInvalidFieldOffsetTag, ::_pbi::kInvalidFieldOffsetTag,
::_pbi::kInvalidFieldOffsetTag,
PROTOBUF_FIELD_OFFSET(::greptime::v1::JsonValue, _impl_.value_), PROTOBUF_FIELD_OFFSET(::greptime::v1::JsonValue, _impl_.value_),
~0u, // no _has_bits_ ~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::greptime::v1::JsonList, _internal_metadata_), PROTOBUF_FIELD_OFFSET(::greptime::v1::JsonList, _internal_metadata_),
@@ -289,9 +290,9 @@ static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protode
{ 63, -1, -1, sizeof(::greptime::v1::ListValue)}, { 63, -1, -1, sizeof(::greptime::v1::ListValue)},
{ 70, -1, -1, sizeof(::greptime::v1::StructValue)}, { 70, -1, -1, sizeof(::greptime::v1::StructValue)},
{ 77, -1, -1, sizeof(::greptime::v1::JsonValue)}, { 77, -1, -1, sizeof(::greptime::v1::JsonValue)},
{ 91, -1, -1, sizeof(::greptime::v1::JsonList)}, { 92, -1, -1, sizeof(::greptime::v1::JsonList)},
{ 98, -1, -1, sizeof(::greptime::v1::JsonObject_Entry)}, { 99, -1, -1, sizeof(::greptime::v1::JsonObject_Entry)},
{ 106, -1, -1, sizeof(::greptime::v1::JsonObject)}, { 107, -1, -1, sizeof(::greptime::v1::JsonObject)},
}; };
static const ::_pb::Message* const file_default_instances[] = { static const ::_pb::Message* const file_default_instances[] = {
@@ -345,25 +346,26 @@ const char descriptor_table_protodef_greptime_2fv1_2frow_2eproto[] PROTOBUF_SECT
"e\030* \001(\0132\026.greptime.v1.JsonValueH\000B\014\n\nval" "e\030* \001(\0132\026.greptime.v1.JsonValueH\000B\014\n\nval"
"ue_data\".\n\tListValue\022!\n\005items\030\001 \003(\0132\022.gr" "ue_data\".\n\tListValue\022!\n\005items\030\001 \003(\0132\022.gr"
"eptime.v1.Value\"0\n\013StructValue\022!\n\005items\030" "eptime.v1.Value\"0\n\013StructValue\022!\n\005items\030"
"\002 \003(\0132\022.greptime.v1.Value\"\271\001\n\tJsonValue\022" "\002 \003(\0132\022.greptime.v1.Value\"\314\001\n\tJsonValue\022"
"\021\n\007boolean\030\001 \001(\010H\000\022\r\n\003int\030\002 \001(\003H\000\022\016\n\004uin" "\021\n\007boolean\030\001 \001(\010H\000\022\r\n\003int\030\002 \001(\003H\000\022\016\n\004uin"
"t\030\003 \001(\004H\000\022\017\n\005float\030\004 \001(\001H\000\022\r\n\003str\030\005 \001(\tH" "t\030\003 \001(\004H\000\022\017\n\005float\030\004 \001(\001H\000\022\r\n\003str\030\005 \001(\tH"
"\000\022&\n\005array\030\006 \001(\0132\025.greptime.v1.JsonListH" "\000\022&\n\005array\030\006 \001(\0132\025.greptime.v1.JsonListH"
"\000\022)\n\006object\030\007 \001(\0132\027.greptime.v1.JsonObje" "\000\022)\n\006object\030\007 \001(\0132\027.greptime.v1.JsonObje"
"ctH\000B\007\n\005value\"1\n\010JsonList\022%\n\005items\030\001 \003(\013" "ctH\000\022\021\n\007variant\030\010 \001(\014H\000B\007\n\005value\"1\n\010Json"
"2\026.greptime.v1.JsonValue\"y\n\nJsonObject\022." "List\022%\n\005items\030\001 \003(\0132\026.greptime.v1.JsonVa"
"\n\007entries\030\001 \003(\0132\035.greptime.v1.JsonObject" "lue\"y\n\nJsonObject\022.\n\007entries\030\001 \003(\0132\035.gre"
".Entry\032;\n\005Entry\022\013\n\003key\030\001 \001(\t\022%\n\005value\030\002 " "ptime.v1.JsonObject.Entry\032;\n\005Entry\022\013\n\003ke"
"\001(\0132\026.greptime.v1.JsonValueBP\n\016io.grepti" "y\030\001 \001(\t\022%\n\005value\030\002 \001(\0132\026.greptime.v1.Jso"
"me.v1B\007RowDataZ5github.com/GreptimeTeam/" "nValueBP\n\016io.greptime.v1B\007RowDataZ5githu"
"greptime-proto/go/greptime/v1b\006proto3" "b.com/GreptimeTeam/greptime-proto/go/gre"
"ptime/v1b\006proto3"
; ;
static const ::_pbi::DescriptorTable* const descriptor_table_greptime_2fv1_2frow_2eproto_deps[1] = { static const ::_pbi::DescriptorTable* const descriptor_table_greptime_2fv1_2frow_2eproto_deps[1] = {
&::descriptor_table_greptime_2fv1_2fcommon_2eproto, &::descriptor_table_greptime_2fv1_2fcommon_2eproto,
}; };
static ::_pbi::once_flag descriptor_table_greptime_2fv1_2frow_2eproto_once; static ::_pbi::once_flag descriptor_table_greptime_2fv1_2frow_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_greptime_2fv1_2frow_2eproto = { const ::_pbi::DescriptorTable descriptor_table_greptime_2fv1_2frow_2eproto = {
false, false, 1957, descriptor_table_protodef_greptime_2fv1_2frow_2eproto, false, false, 1976, descriptor_table_protodef_greptime_2fv1_2frow_2eproto,
"greptime/v1/row.proto", "greptime/v1/row.proto",
&descriptor_table_greptime_2fv1_2frow_2eproto_once, descriptor_table_greptime_2fv1_2frow_2eproto_deps, 1, 10, &descriptor_table_greptime_2fv1_2frow_2eproto_once, descriptor_table_greptime_2fv1_2frow_2eproto_deps, 1, 10,
schemas, file_default_instances, TableStruct_greptime_2fv1_2frow_2eproto::offsets, schemas, file_default_instances, TableStruct_greptime_2fv1_2frow_2eproto::offsets,
@@ -2912,6 +2914,10 @@ JsonValue::JsonValue(const JsonValue& from)
from._internal_object()); from._internal_object());
break; break;
} }
case kVariant: {
_this->_internal_set_variant(from._internal_variant());
break;
}
case VALUE_NOT_SET: { case VALUE_NOT_SET: {
break; break;
} }
@@ -2986,6 +2992,10 @@ void JsonValue::clear_value() {
} }
break; break;
} }
case kVariant: {
_impl_.value_.variant_.Destroy();
break;
}
case VALUE_NOT_SET: { case VALUE_NOT_SET: {
break; break;
} }
@@ -3068,6 +3078,15 @@ const char* JsonValue::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx
} else } else
goto handle_unusual; goto handle_unusual;
continue; continue;
// bytes variant = 8;
case 8:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 66)) {
auto str = _internal_mutable_variant();
ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
} else
goto handle_unusual;
continue;
default: default:
goto handle_unusual; goto handle_unusual;
} // switch } // switch
@@ -3145,6 +3164,12 @@ uint8_t* JsonValue::_InternalSerialize(
_Internal::object(this).GetCachedSize(), target, stream); _Internal::object(this).GetCachedSize(), target, stream);
} }
// bytes variant = 8;
if (_internal_has_variant()) {
target = stream->WriteBytesMaybeAliased(
8, this->_internal_variant(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
@@ -3203,6 +3228,13 @@ size_t JsonValue::ByteSizeLong() const {
*_impl_.value_.object_); *_impl_.value_.object_);
break; break;
} }
// bytes variant = 8;
case kVariant: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
this->_internal_variant());
break;
}
case VALUE_NOT_SET: { case VALUE_NOT_SET: {
break; break;
} }
@@ -3256,6 +3288,10 @@ void JsonValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROT
from._internal_object()); from._internal_object());
break; break;
} }
case kVariant: {
_this->_internal_set_variant(from._internal_variant());
break;
}
case VALUE_NOT_SET: { case VALUE_NOT_SET: {
break; break;
} }
+99
View File
@@ -1707,6 +1707,7 @@ class JsonValue final :
kStr = 5, kStr = 5,
kArray = 6, kArray = 6,
kObject = 7, kObject = 7,
kVariant = 8,
VALUE_NOT_SET = 0, VALUE_NOT_SET = 0,
}; };
@@ -1795,6 +1796,7 @@ class JsonValue final :
kStrFieldNumber = 5, kStrFieldNumber = 5,
kArrayFieldNumber = 6, kArrayFieldNumber = 6,
kObjectFieldNumber = 7, kObjectFieldNumber = 7,
kVariantFieldNumber = 8,
}; };
// bool boolean = 1; // bool boolean = 1;
bool has_boolean() const; bool has_boolean() const;
@@ -1902,6 +1904,24 @@ class JsonValue final :
::greptime::v1::JsonObject* object); ::greptime::v1::JsonObject* object);
::greptime::v1::JsonObject* unsafe_arena_release_object(); ::greptime::v1::JsonObject* unsafe_arena_release_object();
// bytes variant = 8;
bool has_variant() const;
private:
bool _internal_has_variant() const;
public:
void clear_variant();
const std::string& variant() const;
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_variant(ArgT0&& arg0, ArgT... args);
std::string* mutable_variant();
PROTOBUF_NODISCARD std::string* release_variant();
void set_allocated_variant(std::string* variant);
private:
const std::string& _internal_variant() const;
inline PROTOBUF_ALWAYS_INLINE void _internal_set_variant(const std::string& value);
std::string* _internal_mutable_variant();
public:
void clear_value(); void clear_value();
ValueCase value_case() const; ValueCase value_case() const;
// @@protoc_insertion_point(class_scope:greptime.v1.JsonValue) // @@protoc_insertion_point(class_scope:greptime.v1.JsonValue)
@@ -1914,6 +1934,7 @@ class JsonValue final :
void set_has_str(); void set_has_str();
void set_has_array(); void set_has_array();
void set_has_object(); void set_has_object();
void set_has_variant();
inline bool has_value() const; inline bool has_value() const;
inline void clear_has_value(); inline void clear_has_value();
@@ -1932,6 +1953,7 @@ class JsonValue final :
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr str_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr str_;
::greptime::v1::JsonList* array_; ::greptime::v1::JsonList* array_;
::greptime::v1::JsonObject* object_; ::greptime::v1::JsonObject* object_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr variant_;
} value_; } value_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
uint32_t _oneof_case_[1]; uint32_t _oneof_case_[1];
@@ -4692,6 +4714,83 @@ inline ::greptime::v1::JsonObject* JsonValue::mutable_object() {
return _msg; return _msg;
} }
// bytes variant = 8;
inline bool JsonValue::_internal_has_variant() const {
return value_case() == kVariant;
}
inline bool JsonValue::has_variant() const {
return _internal_has_variant();
}
inline void JsonValue::set_has_variant() {
_impl_._oneof_case_[0] = kVariant;
}
inline void JsonValue::clear_variant() {
if (_internal_has_variant()) {
_impl_.value_.variant_.Destroy();
clear_has_value();
}
}
inline const std::string& JsonValue::variant() const {
// @@protoc_insertion_point(field_get:greptime.v1.JsonValue.variant)
return _internal_variant();
}
template <typename ArgT0, typename... ArgT>
inline void JsonValue::set_variant(ArgT0&& arg0, ArgT... args) {
if (!_internal_has_variant()) {
clear_value();
set_has_variant();
_impl_.value_.variant_.InitDefault();
}
_impl_.value_.variant_.SetBytes( static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:greptime.v1.JsonValue.variant)
}
inline std::string* JsonValue::mutable_variant() {
std::string* _s = _internal_mutable_variant();
// @@protoc_insertion_point(field_mutable:greptime.v1.JsonValue.variant)
return _s;
}
inline const std::string& JsonValue::_internal_variant() const {
if (_internal_has_variant()) {
return _impl_.value_.variant_.Get();
}
return ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited();
}
inline void JsonValue::_internal_set_variant(const std::string& value) {
if (!_internal_has_variant()) {
clear_value();
set_has_variant();
_impl_.value_.variant_.InitDefault();
}
_impl_.value_.variant_.Set(value, GetArenaForAllocation());
}
inline std::string* JsonValue::_internal_mutable_variant() {
if (!_internal_has_variant()) {
clear_value();
set_has_variant();
_impl_.value_.variant_.InitDefault();
}
return _impl_.value_.variant_.Mutable( GetArenaForAllocation());
}
inline std::string* JsonValue::release_variant() {
// @@protoc_insertion_point(field_release:greptime.v1.JsonValue.variant)
if (_internal_has_variant()) {
clear_has_value();
return _impl_.value_.variant_.Release();
} else {
return nullptr;
}
}
inline void JsonValue::set_allocated_variant(std::string* variant) {
if (has_value()) {
clear_value();
}
if (variant != nullptr) {
set_has_variant();
_impl_.value_.variant_.InitAllocated(variant, GetArenaForAllocation());
}
// @@protoc_insertion_point(field_set_allocated:greptime.v1.JsonValue.variant)
}
inline bool JsonValue::has_value() const { inline bool JsonValue::has_value() const {
return value_case() != VALUE_NOT_SET; return value_case() != VALUE_NOT_SET;
} }
+38 -21
View File
@@ -798,6 +798,7 @@ type JsonValue struct {
// *JsonValue_Str // *JsonValue_Str
// *JsonValue_Array // *JsonValue_Array
// *JsonValue_Object // *JsonValue_Object
// *JsonValue_Variant
Value isJsonValue_Value `protobuf_oneof:"value"` Value isJsonValue_Value `protobuf_oneof:"value"`
} }
@@ -889,6 +890,13 @@ func (x *JsonValue) GetObject() *JsonObject {
return nil return nil
} }
func (x *JsonValue) GetVariant() []byte {
if x, ok := x.GetValue().(*JsonValue_Variant); ok {
return x.Variant
}
return nil
}
type isJsonValue_Value interface { type isJsonValue_Value interface {
isJsonValue_Value() isJsonValue_Value()
} }
@@ -921,6 +929,10 @@ type JsonValue_Object struct {
Object *JsonObject `protobuf:"bytes,7,opt,name=object,proto3,oneof"` Object *JsonObject `protobuf:"bytes,7,opt,name=object,proto3,oneof"`
} }
type JsonValue_Variant struct {
Variant []byte `protobuf:"bytes,8,opt,name=variant,proto3,oneof"`
}
func (*JsonValue_Boolean) isJsonValue_Value() {} func (*JsonValue_Boolean) isJsonValue_Value() {}
func (*JsonValue_Int) isJsonValue_Value() {} func (*JsonValue_Int) isJsonValue_Value() {}
@@ -935,6 +947,8 @@ func (*JsonValue_Array) isJsonValue_Value() {}
func (*JsonValue_Object) isJsonValue_Value() {} func (*JsonValue_Object) isJsonValue_Value() {}
func (*JsonValue_Variant) isJsonValue_Value() {}
type JsonList struct { type JsonList struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@@ -1216,7 +1230,7 @@ var file_greptime_v1_row_proto_rawDesc = []byte{
0x6d, 0x73, 0x22, 0x37, 0x0a, 0x0b, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x6d, 0x73, 0x22, 0x37, 0x0a, 0x0b, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x56, 0x61, 0x6c, 0x75,
0x65, 0x12, 0x28, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x12, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x32, 0x12, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x56,
0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0xe8, 0x01, 0x0a, 0x09, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x84, 0x02, 0x0a, 0x09,
0x4a, 0x73, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1a, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x4a, 0x73, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1a, 0x0a, 0x07, 0x62, 0x6f, 0x6f,
0x6c, 0x65, 0x61, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x07, 0x62, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x07, 0x62, 0x6f,
0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x12, 0x12, 0x0a, 0x03, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x12, 0x12, 0x0a, 0x03, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01,
@@ -1230,26 +1244,28 @@ var file_greptime_v1_row_proto_rawDesc = []byte{
0x74, 0x48, 0x00, 0x52, 0x05, 0x61, 0x72, 0x72, 0x61, 0x79, 0x12, 0x31, 0x0a, 0x06, 0x6f, 0x62, 0x74, 0x48, 0x00, 0x52, 0x05, 0x61, 0x72, 0x72, 0x61, 0x79, 0x12, 0x31, 0x0a, 0x06, 0x6f, 0x62,
0x6a, 0x65, 0x63, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x65,
0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4a, 0x73, 0x6f, 0x6e, 0x4f, 0x62, 0x6a, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4a, 0x73, 0x6f, 0x6e, 0x4f, 0x62, 0x6a,
0x65, 0x63, 0x74, 0x48, 0x00, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x42, 0x07, 0x0a, 0x65, 0x63, 0x74, 0x48, 0x00, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1a, 0x0a,
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x38, 0x0a, 0x08, 0x4a, 0x73, 0x6f, 0x6e, 0x4c, 0x69, 0x07, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00,
0x73, 0x74, 0x12, 0x2c, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x52, 0x07, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c,
0x0b, 0x32, 0x16, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x75, 0x65, 0x22, 0x38, 0x0a, 0x08, 0x4a, 0x73, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2c,
0x4a, 0x73, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e,
0x22, 0x8e, 0x01, 0x0a, 0x0a, 0x4a, 0x73, 0x6f, 0x6e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4a, 0x73, 0x6f, 0x6e,
0x37, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x8e, 0x01, 0x0a,
0x32, 0x1d, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4a, 0x0a, 0x4a, 0x73, 0x6f, 0x6e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x37, 0x0a, 0x07, 0x65,
0x73, 0x6f, 0x6e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67,
0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x1a, 0x47, 0x0a, 0x05, 0x45, 0x6e, 0x74, 0x72, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4a, 0x73, 0x6f, 0x6e, 0x4f,
0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x65, 0x6e, 0x74,
0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x72, 0x69, 0x65, 0x73, 0x1a, 0x47, 0x0a, 0x05, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
0x2e, 0x4a, 0x73, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16,
0x65, 0x42, 0x50, 0x0a, 0x0e, 0x69, 0x6f, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4a, 0x73, 0x6f,
0x2e, 0x76, 0x31, 0x42, 0x07, 0x52, 0x6f, 0x77, 0x44, 0x61, 0x74, 0x61, 0x5a, 0x35, 0x67, 0x69, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x50, 0x0a,
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x0e, 0x69, 0x6f, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x42,
0x65, 0x54, 0x65, 0x61, 0x6d, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2d, 0x70, 0x07, 0x52, 0x6f, 0x77, 0x44, 0x61, 0x74, 0x61, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x54, 0x65, 0x61,
0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x6d, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, 0x31, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@@ -1478,6 +1494,7 @@ func file_greptime_v1_row_proto_init() {
(*JsonValue_Str)(nil), (*JsonValue_Str)(nil),
(*JsonValue_Array)(nil), (*JsonValue_Array)(nil),
(*JsonValue_Object)(nil), (*JsonValue_Object)(nil),
(*JsonValue_Variant)(nil),
} }
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
+117 -9
View File
@@ -9325,6 +9325,17 @@ public final class RowData {
*/ */
io.greptime.v1.RowData.JsonObjectOrBuilder getObjectOrBuilder(); io.greptime.v1.RowData.JsonObjectOrBuilder getObjectOrBuilder();
/**
* <code>bytes variant = 8;</code>
* @return Whether the variant field is set.
*/
boolean hasVariant();
/**
* <code>bytes variant = 8;</code>
* @return The variant.
*/
com.google.protobuf.ByteString getVariant();
public io.greptime.v1.RowData.JsonValue.ValueCase getValueCase(); public io.greptime.v1.RowData.JsonValue.ValueCase getValueCase();
} }
/** /**
@@ -9426,6 +9437,11 @@ public final class RowData {
valueCase_ = 7; valueCase_ = 7;
break; break;
} }
case 66: {
value_ = input.readBytes();
valueCase_ = 8;
break;
}
default: { default: {
if (!parseUnknownField( if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) { input, unknownFields, extensionRegistry, tag)) {
@@ -9472,6 +9488,7 @@ public final class RowData {
STR(5), STR(5),
ARRAY(6), ARRAY(6),
OBJECT(7), OBJECT(7),
VARIANT(8),
VALUE_NOT_SET(0); VALUE_NOT_SET(0);
private final int value; private final int value;
private ValueCase(int value) { private ValueCase(int value) {
@@ -9496,6 +9513,7 @@ public final class RowData {
case 5: return STR; case 5: return STR;
case 6: return ARRAY; case 6: return ARRAY;
case 7: return OBJECT; case 7: return OBJECT;
case 8: return VARIANT;
case 0: return VALUE_NOT_SET; case 0: return VALUE_NOT_SET;
default: return null; default: return null;
} }
@@ -9709,6 +9727,27 @@ public final class RowData {
return io.greptime.v1.RowData.JsonObject.getDefaultInstance(); return io.greptime.v1.RowData.JsonObject.getDefaultInstance();
} }
public static final int VARIANT_FIELD_NUMBER = 8;
/**
* <code>bytes variant = 8;</code>
* @return Whether the variant field is set.
*/
@java.lang.Override
public boolean hasVariant() {
return valueCase_ == 8;
}
/**
* <code>bytes variant = 8;</code>
* @return The variant.
*/
@java.lang.Override
public com.google.protobuf.ByteString getVariant() {
if (valueCase_ == 8) {
return (com.google.protobuf.ByteString) value_;
}
return com.google.protobuf.ByteString.EMPTY;
}
private byte memoizedIsInitialized = -1; private byte memoizedIsInitialized = -1;
@java.lang.Override @java.lang.Override
public final boolean isInitialized() { public final boolean isInitialized() {
@@ -9748,6 +9787,10 @@ public final class RowData {
if (valueCase_ == 7) { if (valueCase_ == 7) {
output.writeMessage(7, (io.greptime.v1.RowData.JsonObject) value_); output.writeMessage(7, (io.greptime.v1.RowData.JsonObject) value_);
} }
if (valueCase_ == 8) {
output.writeBytes(
8, (com.google.protobuf.ByteString) value_);
}
unknownFields.writeTo(output); unknownFields.writeTo(output);
} }
@@ -9788,6 +9831,11 @@ public final class RowData {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeMessageSize(7, (io.greptime.v1.RowData.JsonObject) value_); .computeMessageSize(7, (io.greptime.v1.RowData.JsonObject) value_);
} }
if (valueCase_ == 8) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(
8, (com.google.protobuf.ByteString) value_);
}
size += unknownFields.getSerializedSize(); size += unknownFields.getSerializedSize();
memoizedSize = size; memoizedSize = size;
return size; return size;
@@ -9834,6 +9882,10 @@ public final class RowData {
if (!getObject() if (!getObject()
.equals(other.getObject())) return false; .equals(other.getObject())) return false;
break; break;
case 8:
if (!getVariant()
.equals(other.getVariant())) return false;
break;
case 0: case 0:
default: default:
} }
@@ -9881,6 +9933,10 @@ public final class RowData {
hash = (37 * hash) + OBJECT_FIELD_NUMBER; hash = (37 * hash) + OBJECT_FIELD_NUMBER;
hash = (53 * hash) + getObject().hashCode(); hash = (53 * hash) + getObject().hashCode();
break; break;
case 8:
hash = (37 * hash) + VARIANT_FIELD_NUMBER;
hash = (53 * hash) + getVariant().hashCode();
break;
case 0: case 0:
default: default:
} }
@@ -10074,6 +10130,9 @@ public final class RowData {
result.value_ = objectBuilder_.build(); result.value_ = objectBuilder_.build();
} }
} }
if (valueCase_ == 8) {
result.value_ = value_;
}
result.valueCase_ = valueCase_; result.valueCase_ = valueCase_;
onBuilt(); onBuilt();
return result; return result;
@@ -10154,6 +10213,10 @@ public final class RowData {
mergeObject(other.getObject()); mergeObject(other.getObject());
break; break;
} }
case VARIANT: {
setVariant(other.getVariant());
break;
}
case VALUE_NOT_SET: { case VALUE_NOT_SET: {
break; break;
} }
@@ -10746,6 +10809,50 @@ public final class RowData {
onChanged();; onChanged();;
return objectBuilder_; return objectBuilder_;
} }
/**
* <code>bytes variant = 8;</code>
* @return Whether the variant field is set.
*/
public boolean hasVariant() {
return valueCase_ == 8;
}
/**
* <code>bytes variant = 8;</code>
* @return The variant.
*/
public com.google.protobuf.ByteString getVariant() {
if (valueCase_ == 8) {
return (com.google.protobuf.ByteString) value_;
}
return com.google.protobuf.ByteString.EMPTY;
}
/**
* <code>bytes variant = 8;</code>
* @param value The variant to set.
* @return This builder for chaining.
*/
public Builder setVariant(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
valueCase_ = 8;
value_ = value;
onChanged();
return this;
}
/**
* <code>bytes variant = 8;</code>
* @return This builder for chaining.
*/
public Builder clearVariant() {
if (valueCase_ == 8) {
valueCase_ = 0;
value_ = null;
onChanged();
}
return this;
}
@java.lang.Override @java.lang.Override
public final Builder setUnknownFields( public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) { final com.google.protobuf.UnknownFieldSet unknownFields) {
@@ -13258,18 +13365,19 @@ public final class RowData {
"e\030* \001(\0132\026.greptime.v1.JsonValueH\000B\014\n\nval" + "e\030* \001(\0132\026.greptime.v1.JsonValueH\000B\014\n\nval" +
"ue_data\".\n\tListValue\022!\n\005items\030\001 \003(\0132\022.gr" + "ue_data\".\n\tListValue\022!\n\005items\030\001 \003(\0132\022.gr" +
"eptime.v1.Value\"0\n\013StructValue\022!\n\005items\030" + "eptime.v1.Value\"0\n\013StructValue\022!\n\005items\030" +
"\002 \003(\0132\022.greptime.v1.Value\"\271\001\n\tJsonValue\022" + "\002 \003(\0132\022.greptime.v1.Value\"\314\001\n\tJsonValue\022" +
"\021\n\007boolean\030\001 \001(\010H\000\022\r\n\003int\030\002 \001(\003H\000\022\016\n\004uin" + "\021\n\007boolean\030\001 \001(\010H\000\022\r\n\003int\030\002 \001(\003H\000\022\016\n\004uin" +
"t\030\003 \001(\004H\000\022\017\n\005float\030\004 \001(\001H\000\022\r\n\003str\030\005 \001(\tH" + "t\030\003 \001(\004H\000\022\017\n\005float\030\004 \001(\001H\000\022\r\n\003str\030\005 \001(\tH" +
"\000\022&\n\005array\030\006 \001(\0132\025.greptime.v1.JsonListH" + "\000\022&\n\005array\030\006 \001(\0132\025.greptime.v1.JsonListH" +
"\000\022)\n\006object\030\007 \001(\0132\027.greptime.v1.JsonObje" + "\000\022)\n\006object\030\007 \001(\0132\027.greptime.v1.JsonObje" +
"ctH\000B\007\n\005value\"1\n\010JsonList\022%\n\005items\030\001 \003(\013" + "ctH\000\022\021\n\007variant\030\010 \001(\014H\000B\007\n\005value\"1\n\010Json" +
"2\026.greptime.v1.JsonValue\"y\n\nJsonObject\022." + "List\022%\n\005items\030\001 \003(\0132\026.greptime.v1.JsonVa" +
"\n\007entries\030\001 \003(\0132\035.greptime.v1.JsonObject" + "lue\"y\n\nJsonObject\022.\n\007entries\030\001 \003(\0132\035.gre" +
".Entry\032;\n\005Entry\022\013\n\003key\030\001 \001(\t\022%\n\005value\030\002 " + "ptime.v1.JsonObject.Entry\032;\n\005Entry\022\013\n\003ke" +
"\001(\0132\026.greptime.v1.JsonValueBP\n\016io.grepti" + "y\030\001 \001(\t\022%\n\005value\030\002 \001(\0132\026.greptime.v1.Jso" +
"me.v1B\007RowDataZ5github.com/GreptimeTeam/" + "nValueBP\n\016io.greptime.v1B\007RowDataZ5githu" +
"greptime-proto/go/greptime/v1b\006proto3" "b.com/GreptimeTeam/greptime-proto/go/gre" +
"ptime/v1b\006proto3"
}; };
descriptor = com.google.protobuf.Descriptors.FileDescriptor descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData, .internalBuildGeneratedFileFrom(descriptorData,
@@ -13317,7 +13425,7 @@ public final class RowData {
internal_static_greptime_v1_JsonValue_fieldAccessorTable = new internal_static_greptime_v1_JsonValue_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_greptime_v1_JsonValue_descriptor, internal_static_greptime_v1_JsonValue_descriptor,
new java.lang.String[] { "Boolean", "Int", "Uint", "Float", "Str", "Array", "Object", "Value", }); new java.lang.String[] { "Boolean", "Int", "Uint", "Float", "Str", "Array", "Object", "Variant", "Value", });
internal_static_greptime_v1_JsonList_descriptor = internal_static_greptime_v1_JsonList_descriptor =
getDescriptor().getMessageTypes().get(7); getDescriptor().getMessageTypes().get(7);
internal_static_greptime_v1_JsonList_fieldAccessorTable = new internal_static_greptime_v1_JsonList_fieldAccessorTable = new
+1
View File
@@ -100,6 +100,7 @@ message JsonValue {
string str = 5; string str = 5;
JsonList array = 6; JsonList array = 6;
JsonObject object = 7; JsonObject object = 7;
bytes variant = 8;
} }
} }
+3 -1
View File
@@ -634,7 +634,7 @@ pub struct StructValue {
} }
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct JsonValue { pub struct JsonValue {
#[prost(oneof = "json_value::Value", tags = "1, 2, 3, 4, 5, 6, 7")] #[prost(oneof = "json_value::Value", tags = "1, 2, 3, 4, 5, 6, 7, 8")]
pub value: ::core::option::Option<json_value::Value>, pub value: ::core::option::Option<json_value::Value>,
} }
/// Nested message and enum types in `JsonValue`. /// Nested message and enum types in `JsonValue`.
@@ -655,6 +655,8 @@ pub mod json_value {
Array(super::JsonList), Array(super::JsonList),
#[prost(message, tag = "7")] #[prost(message, tag = "7")]
Object(super::JsonObject), Object(super::JsonObject),
#[prost(bytes, tag = "8")]
Variant(::prost::alloc::vec::Vec<u8>),
} }
} }
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
Binary file not shown.