feat: add type extension for column (#122)
* feat: decimal128 proto * chore: make all * chore: empty line * refactor: remove precision and scale * chore: cr comment Co-authored-by: Yingwen <realevenyag@gmail.com> --------- Co-authored-by: Yingwen <realevenyag@gmail.com>
This commit is contained in:
+64
-13
@@ -229,6 +229,7 @@ PROTOBUF_CONSTEXPR ColumnDef::ColumnDef(
|
||||
/*decltype(_impl_.name_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
|
||||
, /*decltype(_impl_.default_constraint_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
|
||||
, /*decltype(_impl_.comment_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
|
||||
, /*decltype(_impl_.datatype_extension_)*/nullptr
|
||||
, /*decltype(_impl_.data_type_)*/0
|
||||
, /*decltype(_impl_.is_nullable_)*/false
|
||||
, /*decltype(_impl_.semantic_type_)*/0
|
||||
@@ -409,6 +410,7 @@ const uint32_t TableStruct_greptime_2fv1_2fddl_2eproto::offsets[] PROTOBUF_SECTI
|
||||
PROTOBUF_FIELD_OFFSET(::greptime::v1::ColumnDef, _impl_.default_constraint_),
|
||||
PROTOBUF_FIELD_OFFSET(::greptime::v1::ColumnDef, _impl_.semantic_type_),
|
||||
PROTOBUF_FIELD_OFFSET(::greptime::v1::ColumnDef, _impl_.comment_),
|
||||
PROTOBUF_FIELD_OFFSET(::greptime::v1::ColumnDef, _impl_.datatype_extension_),
|
||||
~0u, // no _has_bits_
|
||||
PROTOBUF_FIELD_OFFSET(::greptime::v1::AddColumnLocation, _internal_metadata_),
|
||||
~0u, // no _extensions_
|
||||
@@ -434,7 +436,7 @@ static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protode
|
||||
{ 120, -1, -1, sizeof(::greptime::v1::DropColumn)},
|
||||
{ 127, -1, -1, sizeof(::greptime::v1::TableId)},
|
||||
{ 134, -1, -1, sizeof(::greptime::v1::ColumnDef)},
|
||||
{ 146, -1, -1, sizeof(::greptime::v1::AddColumnLocation)},
|
||||
{ 147, -1, -1, sizeof(::greptime::v1::AddColumnLocation)},
|
||||
};
|
||||
|
||||
static const ::_pb::Message* const file_default_instances[] = {
|
||||
@@ -500,24 +502,26 @@ const char descriptor_table_protodef_greptime_2fv1_2fddl_2eproto[] PROTOBUF_SECT
|
||||
"\026.greptime.v1.ColumnDef\0220\n\010location\030\003 \001("
|
||||
"\0132\036.greptime.v1.AddColumnLocation\"\032\n\nDro"
|
||||
"pColumn\022\014\n\004name\030\001 \001(\t\"\025\n\007TableId\022\n\n\002id\030\001"
|
||||
" \001(\r\"\275\001\n\tColumnDef\022\014\n\004name\030\001 \001(\t\022.\n\tdata"
|
||||
" \001(\r\"\377\001\n\tColumnDef\022\014\n\004name\030\001 \001(\t\022.\n\tdata"
|
||||
"_type\030\002 \001(\0162\033.greptime.v1.ColumnDataType"
|
||||
"\022\023\n\013is_nullable\030\003 \001(\010\022\032\n\022default_constra"
|
||||
"int\030\004 \001(\014\0220\n\rsemantic_type\030\005 \001(\0162\031.grept"
|
||||
"ime.v1.SemanticType\022\017\n\007comment\030\006 \001(\t\"\230\001\n"
|
||||
"\021AddColumnLocation\022B\n\rlocation_type\030\001 \001("
|
||||
"\0162+.greptime.v1.AddColumnLocation.Locati"
|
||||
"onType\022\031\n\021after_column_name\030\002 \001(\t\"$\n\014Loc"
|
||||
"ationType\022\t\n\005FIRST\020\000\022\t\n\005AFTER\020\001BL\n\016io.gr"
|
||||
"eptime.v1B\003DdlZ5github.com/GreptimeTeam/"
|
||||
"greptime-proto/go/greptime/v1b\006proto3"
|
||||
"ime.v1.SemanticType\022\017\n\007comment\030\006 \001(\t\022@\n\022"
|
||||
"datatype_extension\030\007 \001(\0132$.greptime.v1.C"
|
||||
"olumnDataTypeExtension\"\230\001\n\021AddColumnLoca"
|
||||
"tion\022B\n\rlocation_type\030\001 \001(\0162+.greptime.v"
|
||||
"1.AddColumnLocation.LocationType\022\031\n\021afte"
|
||||
"r_column_name\030\002 \001(\t\"$\n\014LocationType\022\t\n\005F"
|
||||
"IRST\020\000\022\t\n\005AFTER\020\001BL\n\016io.greptime.v1B\003Ddl"
|
||||
"Z5github.com/GreptimeTeam/greptime-proto"
|
||||
"/go/greptime/v1b\006proto3"
|
||||
;
|
||||
static const ::_pbi::DescriptorTable* const descriptor_table_greptime_2fv1_2fddl_2eproto_deps[1] = {
|
||||
&::descriptor_table_greptime_2fv1_2fcommon_2eproto,
|
||||
};
|
||||
static ::_pbi::once_flag descriptor_table_greptime_2fv1_2fddl_2eproto_once;
|
||||
const ::_pbi::DescriptorTable descriptor_table_greptime_2fv1_2fddl_2eproto = {
|
||||
false, false, 2157, descriptor_table_protodef_greptime_2fv1_2fddl_2eproto,
|
||||
false, false, 2223, descriptor_table_protodef_greptime_2fv1_2fddl_2eproto,
|
||||
"greptime/v1/ddl.proto",
|
||||
&descriptor_table_greptime_2fv1_2fddl_2eproto_once, descriptor_table_greptime_2fv1_2fddl_2eproto_deps, 1, 16,
|
||||
schemas, file_default_instances, TableStruct_greptime_2fv1_2fddl_2eproto::offsets,
|
||||
@@ -4428,8 +4432,19 @@ void TableId::InternalSwap(TableId* other) {
|
||||
|
||||
class ColumnDef::_Internal {
|
||||
public:
|
||||
static const ::greptime::v1::ColumnDataTypeExtension& datatype_extension(const ColumnDef* msg);
|
||||
};
|
||||
|
||||
const ::greptime::v1::ColumnDataTypeExtension&
|
||||
ColumnDef::_Internal::datatype_extension(const ColumnDef* msg) {
|
||||
return *msg->_impl_.datatype_extension_;
|
||||
}
|
||||
void ColumnDef::clear_datatype_extension() {
|
||||
if (GetArenaForAllocation() == nullptr && _impl_.datatype_extension_ != nullptr) {
|
||||
delete _impl_.datatype_extension_;
|
||||
}
|
||||
_impl_.datatype_extension_ = nullptr;
|
||||
}
|
||||
ColumnDef::ColumnDef(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
|
||||
@@ -4443,6 +4458,7 @@ ColumnDef::ColumnDef(const ColumnDef& from)
|
||||
decltype(_impl_.name_){}
|
||||
, decltype(_impl_.default_constraint_){}
|
||||
, decltype(_impl_.comment_){}
|
||||
, decltype(_impl_.datatype_extension_){nullptr}
|
||||
, decltype(_impl_.data_type_){}
|
||||
, decltype(_impl_.is_nullable_){}
|
||||
, decltype(_impl_.semantic_type_){}
|
||||
@@ -4473,6 +4489,9 @@ ColumnDef::ColumnDef(const ColumnDef& from)
|
||||
_this->_impl_.comment_.Set(from._internal_comment(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
if (from._internal_has_datatype_extension()) {
|
||||
_this->_impl_.datatype_extension_ = new ::greptime::v1::ColumnDataTypeExtension(*from._impl_.datatype_extension_);
|
||||
}
|
||||
::memcpy(&_impl_.data_type_, &from._impl_.data_type_,
|
||||
static_cast<size_t>(reinterpret_cast<char*>(&_impl_.semantic_type_) -
|
||||
reinterpret_cast<char*>(&_impl_.data_type_)) + sizeof(_impl_.semantic_type_));
|
||||
@@ -4487,6 +4506,7 @@ inline void ColumnDef::SharedCtor(
|
||||
decltype(_impl_.name_){}
|
||||
, decltype(_impl_.default_constraint_){}
|
||||
, decltype(_impl_.comment_){}
|
||||
, decltype(_impl_.datatype_extension_){nullptr}
|
||||
, decltype(_impl_.data_type_){0}
|
||||
, decltype(_impl_.is_nullable_){false}
|
||||
, decltype(_impl_.semantic_type_){0}
|
||||
@@ -4520,6 +4540,7 @@ inline void ColumnDef::SharedDtor() {
|
||||
_impl_.name_.Destroy();
|
||||
_impl_.default_constraint_.Destroy();
|
||||
_impl_.comment_.Destroy();
|
||||
if (this != internal_default_instance()) delete _impl_.datatype_extension_;
|
||||
}
|
||||
|
||||
void ColumnDef::SetCachedSize(int size) const {
|
||||
@@ -4535,6 +4556,10 @@ void ColumnDef::Clear() {
|
||||
_impl_.name_.ClearToEmpty();
|
||||
_impl_.default_constraint_.ClearToEmpty();
|
||||
_impl_.comment_.ClearToEmpty();
|
||||
if (GetArenaForAllocation() == nullptr && _impl_.datatype_extension_ != nullptr) {
|
||||
delete _impl_.datatype_extension_;
|
||||
}
|
||||
_impl_.datatype_extension_ = nullptr;
|
||||
::memset(&_impl_.data_type_, 0, static_cast<size_t>(
|
||||
reinterpret_cast<char*>(&_impl_.semantic_type_) -
|
||||
reinterpret_cast<char*>(&_impl_.data_type_)) + sizeof(_impl_.semantic_type_));
|
||||
@@ -4602,6 +4627,14 @@ const char* ColumnDef::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// .greptime.v1.ColumnDataTypeExtension datatype_extension = 7;
|
||||
case 7:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
|
||||
ptr = ctx->ParseMessage(_internal_mutable_datatype_extension(), ptr);
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
default:
|
||||
goto handle_unusual;
|
||||
} // switch
|
||||
@@ -4677,6 +4710,13 @@ uint8_t* ColumnDef::_InternalSerialize(
|
||||
6, this->_internal_comment(), target);
|
||||
}
|
||||
|
||||
// .greptime.v1.ColumnDataTypeExtension datatype_extension = 7;
|
||||
if (this->_internal_has_datatype_extension()) {
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
|
||||
InternalWriteMessage(7, _Internal::datatype_extension(this),
|
||||
_Internal::datatype_extension(this).GetCachedSize(), target, stream);
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -4714,6 +4754,13 @@ size_t ColumnDef::ByteSizeLong() const {
|
||||
this->_internal_comment());
|
||||
}
|
||||
|
||||
// .greptime.v1.ColumnDataTypeExtension datatype_extension = 7;
|
||||
if (this->_internal_has_datatype_extension()) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
|
||||
*_impl_.datatype_extension_);
|
||||
}
|
||||
|
||||
// .greptime.v1.ColumnDataType data_type = 2;
|
||||
if (this->_internal_data_type() != 0) {
|
||||
total_size += 1 +
|
||||
@@ -4758,6 +4805,10 @@ void ColumnDef::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROT
|
||||
if (!from._internal_comment().empty()) {
|
||||
_this->_internal_set_comment(from._internal_comment());
|
||||
}
|
||||
if (from._internal_has_datatype_extension()) {
|
||||
_this->_internal_mutable_datatype_extension()->::greptime::v1::ColumnDataTypeExtension::MergeFrom(
|
||||
from._internal_datatype_extension());
|
||||
}
|
||||
if (from._internal_data_type() != 0) {
|
||||
_this->_internal_set_data_type(from._internal_data_type());
|
||||
}
|
||||
@@ -4801,9 +4852,9 @@ void ColumnDef::InternalSwap(ColumnDef* other) {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::memswap<
|
||||
PROTOBUF_FIELD_OFFSET(ColumnDef, _impl_.semantic_type_)
|
||||
+ sizeof(ColumnDef::_impl_.semantic_type_)
|
||||
- PROTOBUF_FIELD_OFFSET(ColumnDef, _impl_.data_type_)>(
|
||||
reinterpret_cast<char*>(&_impl_.data_type_),
|
||||
reinterpret_cast<char*>(&other->_impl_.data_type_));
|
||||
- PROTOBUF_FIELD_OFFSET(ColumnDef, _impl_.datatype_extension_)>(
|
||||
reinterpret_cast<char*>(&_impl_.datatype_extension_),
|
||||
reinterpret_cast<char*>(&other->_impl_.datatype_extension_));
|
||||
}
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata ColumnDef::GetMetadata() const {
|
||||
|
||||
Reference in New Issue
Block a user