feat: alter fulltext index (#196)

This commit is contained in:
Yohan Wal
2024-11-09 07:06:55 +08:00
committed by GitHub
parent 396206c280
commit 67bb1d52bc
9 changed files with 2990 additions and 412 deletions
+105 -35
View File
@@ -623,6 +623,7 @@ const uint32_t TableStruct_greptime_2fv1_2fregion_2fserver_2eproto::offsets[] PR
::_pbi::kInvalidFieldOffsetTag,
::_pbi::kInvalidFieldOffsetTag,
::_pbi::kInvalidFieldOffsetTag,
::_pbi::kInvalidFieldOffsetTag,
PROTOBUF_FIELD_OFFSET(::greptime::v1::region::AlterRequest, _impl_.schema_version_),
PROTOBUF_FIELD_OFFSET(::greptime::v1::region::AlterRequest, _impl_.kind_),
~0u, // no _has_bits_
@@ -721,16 +722,16 @@ static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protode
{ 161, -1, -1, sizeof(::greptime::v1::region::CloseRequest)},
{ 168, -1, -1, sizeof(::greptime::v1::region::AlterRequests)},
{ 175, -1, -1, sizeof(::greptime::v1::region::AlterRequest)},
{ 188, -1, -1, sizeof(::greptime::v1::region::AddColumns)},
{ 195, -1, -1, sizeof(::greptime::v1::region::DropColumns)},
{ 202, -1, -1, sizeof(::greptime::v1::region::AddColumn)},
{ 210, -1, -1, sizeof(::greptime::v1::region::DropColumn)},
{ 217, -1, -1, sizeof(::greptime::v1::region::FlushRequest)},
{ 224, -1, -1, sizeof(::greptime::v1::region::Regular)},
{ 230, -1, -1, sizeof(::greptime::v1::region::StrictWindow)},
{ 237, -1, -1, sizeof(::greptime::v1::region::CompactRequest)},
{ 247, -1, -1, sizeof(::greptime::v1::region::TruncateRequest)},
{ 254, -1, -1, sizeof(::greptime::v1::region::RegionColumnDef)},
{ 189, -1, -1, sizeof(::greptime::v1::region::AddColumns)},
{ 196, -1, -1, sizeof(::greptime::v1::region::DropColumns)},
{ 203, -1, -1, sizeof(::greptime::v1::region::AddColumn)},
{ 211, -1, -1, sizeof(::greptime::v1::region::DropColumn)},
{ 218, -1, -1, sizeof(::greptime::v1::region::FlushRequest)},
{ 225, -1, -1, sizeof(::greptime::v1::region::Regular)},
{ 231, -1, -1, sizeof(::greptime::v1::region::StrictWindow)},
{ 238, -1, -1, sizeof(::greptime::v1::region::CompactRequest)},
{ 248, -1, -1, sizeof(::greptime::v1::region::TruncateRequest)},
{ 255, -1, -1, sizeof(::greptime::v1::region::RegionColumnDef)},
};
static const ::_pb::Message* const file_default_instances[] = {
@@ -827,36 +828,38 @@ const char descriptor_table_protodef_greptime_2fv1_2fregion_2fserver_2eproto[] P
".\n\014OptionsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 "
"\001(\t:\0028\001\"!\n\014CloseRequest\022\021\n\tregion_id\030\001 \001"
"(\004\"C\n\rAlterRequests\0222\n\010requests\030\001 \003(\0132 ."
"greptime.v1.region.AlterRequest\"\261\002\n\014Alte"
"greptime.v1.region.AlterRequest\"\366\002\n\014Alte"
"rRequest\022\021\n\tregion_id\030\001 \001(\004\0225\n\013add_colum"
"ns\030\002 \001(\0132\036.greptime.v1.region.AddColumns"
"H\000\0227\n\014drop_columns\030\003 \001(\0132\037.greptime.v1.r"
"egion.DropColumnsH\000\022=\n\023change_column_typ"
"es\030\005 \001(\0132\036.greptime.v1.ChangeColumnTypes"
"H\000\022\?\n\024change_table_options\030\006 \001(\0132\037.grept"
"ime.v1.ChangeTableOptionsH\000\022\026\n\016schema_ve"
"rsion\030\004 \001(\004B\006\n\004kind\"@\n\nAddColumns\0222\n\013add"
"_columns\030\001 \003(\0132\035.greptime.v1.region.AddC"
"olumn\"C\n\013DropColumns\0224\n\014drop_columns\030\001 \003"
"(\0132\036.greptime.v1.region.DropColumn\"v\n\tAd"
"dColumn\0227\n\ncolumn_def\030\001 \001(\0132#.greptime.v"
"1.region.RegionColumnDef\0220\n\010location\030\003 \001"
"(\0132\036.greptime.v1.AddColumnLocation\"\032\n\nDr"
"opColumn\022\014\n\004name\030\001 \001(\t\"!\n\014FlushRequest\022\021"
"\n\tregion_id\030\001 \001(\004\"\t\n\007Regular\"&\n\014StrictWi"
"ndow\022\026\n\016window_seconds\030\001 \001(\003\"\231\001\n\016Compact"
"Request\022\021\n\tregion_id\030\001 \001(\004\022.\n\007regular\030\002 "
"\001(\0132\033.greptime.v1.region.RegularH\000\0229\n\rst"
"rict_window\030\003 \001(\0132 .greptime.v1.region.S"
"trictWindowH\000B\t\n\007options\"$\n\017TruncateRequ"
"est\022\021\n\tregion_id\030\001 \001(\004\"P\n\017RegionColumnDe"
"f\022*\n\ncolumn_def\030\001 \001(\0132\026.greptime.v1.Colu"
"mnDef\022\021\n\tcolumn_id\030\002 \001(\r2Y\n\006Region\022O\n\006Ha"
"ndle\022!.greptime.v1.region.RegionRequest\032"
"\".greptime.v1.region.RegionResponseB]\n\025i"
"o.greptime.v1.regionB\006ServerZ<github.com"
"/GreptimeTeam/greptime-proto/go/greptime"
"/v1/regionb\006proto3"
"ime.v1.ChangeTableOptionsH\000\022C\n\026change_co"
"lumn_fulltext\030\007 \001(\0132!.greptime.v1.Change"
"ColumnFulltextH\000\022\026\n\016schema_version\030\004 \001(\004"
"B\006\n\004kind\"@\n\nAddColumns\0222\n\013add_columns\030\001 "
"\003(\0132\035.greptime.v1.region.AddColumn\"C\n\013Dr"
"opColumns\0224\n\014drop_columns\030\001 \003(\0132\036.grepti"
"me.v1.region.DropColumn\"v\n\tAddColumn\0227\n\n"
"column_def\030\001 \001(\0132#.greptime.v1.region.Re"
"gionColumnDef\0220\n\010location\030\003 \001(\0132\036.grepti"
"me.v1.AddColumnLocation\"\032\n\nDropColumn\022\014\n"
"\004name\030\001 \001(\t\"!\n\014FlushRequest\022\021\n\tregion_id"
"\030\001 \001(\004\"\t\n\007Regular\"&\n\014StrictWindow\022\026\n\016win"
"dow_seconds\030\001 \001(\003\"\231\001\n\016CompactRequest\022\021\n\t"
"region_id\030\001 \001(\004\022.\n\007regular\030\002 \001(\0132\033.grept"
"ime.v1.region.RegularH\000\0229\n\rstrict_window"
"\030\003 \001(\0132 .greptime.v1.region.StrictWindow"
"H\000B\t\n\007options\"$\n\017TruncateRequest\022\021\n\tregi"
"on_id\030\001 \001(\004\"P\n\017RegionColumnDef\022*\n\ncolumn"
"_def\030\001 \001(\0132\026.greptime.v1.ColumnDef\022\021\n\tco"
"lumn_id\030\002 \001(\r2Y\n\006Region\022O\n\006Handle\022!.grep"
"time.v1.region.RegionRequest\032\".greptime."
"v1.region.RegionResponseB]\n\025io.greptime."
"v1.regionB\006ServerZ<github.com/GreptimeTe"
"am/greptime-proto/go/greptime/v1/regionb"
"\006proto3"
;
static const ::_pbi::DescriptorTable* const descriptor_table_greptime_2fv1_2fregion_2fserver_2eproto_deps[3] = {
&::descriptor_table_greptime_2fv1_2fcommon_2eproto,
@@ -865,7 +868,7 @@ static const ::_pbi::DescriptorTable* const descriptor_table_greptime_2fv1_2freg
};
static ::_pbi::once_flag descriptor_table_greptime_2fv1_2fregion_2fserver_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_greptime_2fv1_2fregion_2fserver_2eproto = {
false, false, 3578, descriptor_table_protodef_greptime_2fv1_2fregion_2fserver_2eproto,
false, false, 3647, descriptor_table_protodef_greptime_2fv1_2fregion_2fserver_2eproto,
"greptime/v1/region/server.proto",
&descriptor_table_greptime_2fv1_2fregion_2fserver_2eproto_once, descriptor_table_greptime_2fv1_2fregion_2fserver_2eproto_deps, 3, 30,
schemas, file_default_instances, TableStruct_greptime_2fv1_2fregion_2fserver_2eproto::offsets,
@@ -5328,6 +5331,7 @@ class AlterRequest::_Internal {
static const ::greptime::v1::region::DropColumns& drop_columns(const AlterRequest* msg);
static const ::greptime::v1::ChangeColumnTypes& change_column_types(const AlterRequest* msg);
static const ::greptime::v1::ChangeTableOptions& change_table_options(const AlterRequest* msg);
static const ::greptime::v1::ChangeColumnFulltext& change_column_fulltext(const AlterRequest* msg);
};
const ::greptime::v1::region::AddColumns&
@@ -5346,6 +5350,10 @@ const ::greptime::v1::ChangeTableOptions&
AlterRequest::_Internal::change_table_options(const AlterRequest* msg) {
return *msg->_impl_.kind_.change_table_options_;
}
const ::greptime::v1::ChangeColumnFulltext&
AlterRequest::_Internal::change_column_fulltext(const AlterRequest* msg) {
return *msg->_impl_.kind_.change_column_fulltext_;
}
void AlterRequest::set_allocated_add_columns(::greptime::v1::region::AddColumns* add_columns) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
clear_kind();
@@ -5424,6 +5432,30 @@ void AlterRequest::clear_change_table_options() {
clear_has_kind();
}
}
void AlterRequest::set_allocated_change_column_fulltext(::greptime::v1::ChangeColumnFulltext* change_column_fulltext) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
clear_kind();
if (change_column_fulltext) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(
reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(change_column_fulltext));
if (message_arena != submessage_arena) {
change_column_fulltext = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, change_column_fulltext, submessage_arena);
}
set_has_change_column_fulltext();
_impl_.kind_.change_column_fulltext_ = change_column_fulltext;
}
// @@protoc_insertion_point(field_set_allocated:greptime.v1.region.AlterRequest.change_column_fulltext)
}
void AlterRequest::clear_change_column_fulltext() {
if (_internal_has_change_column_fulltext()) {
if (GetArenaForAllocation() == nullptr) {
delete _impl_.kind_.change_column_fulltext_;
}
clear_has_kind();
}
}
AlterRequest::AlterRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
@@ -5466,6 +5498,11 @@ AlterRequest::AlterRequest(const AlterRequest& from)
from._internal_change_table_options());
break;
}
case kChangeColumnFulltext: {
_this->_internal_mutable_change_column_fulltext()->::greptime::v1::ChangeColumnFulltext::MergeFrom(
from._internal_change_column_fulltext());
break;
}
case KIND_NOT_SET: {
break;
}
@@ -5534,6 +5571,12 @@ void AlterRequest::clear_kind() {
}
break;
}
case kChangeColumnFulltext: {
if (GetArenaForAllocation() == nullptr) {
delete _impl_.kind_.change_column_fulltext_;
}
break;
}
case KIND_NOT_SET: {
break;
}
@@ -5609,6 +5652,14 @@ const char* AlterRequest::_InternalParse(const char* ptr, ::_pbi::ParseContext*
} else
goto handle_unusual;
continue;
// .greptime.v1.ChangeColumnFulltext change_column_fulltext = 7;
case 7:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
ptr = ctx->ParseMessage(_internal_mutable_change_column_fulltext(), ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
default:
goto handle_unusual;
} // switch
@@ -5678,6 +5729,13 @@ uint8_t* AlterRequest::_InternalSerialize(
_Internal::change_table_options(this).GetCachedSize(), target, stream);
}
// .greptime.v1.ChangeColumnFulltext change_column_fulltext = 7;
if (_internal_has_change_column_fulltext()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(7, _Internal::change_column_fulltext(this),
_Internal::change_column_fulltext(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);
@@ -5733,6 +5791,13 @@ size_t AlterRequest::ByteSizeLong() const {
*_impl_.kind_.change_table_options_);
break;
}
// .greptime.v1.ChangeColumnFulltext change_column_fulltext = 7;
case kChangeColumnFulltext: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.kind_.change_column_fulltext_);
break;
}
case KIND_NOT_SET: {
break;
}
@@ -5782,6 +5847,11 @@ void AlterRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::P
from._internal_change_table_options());
break;
}
case kChangeColumnFulltext: {
_this->_internal_mutable_change_column_fulltext()->::greptime::v1::ChangeColumnFulltext::MergeFrom(
from._internal_change_column_fulltext());
break;
}
case KIND_NOT_SET: {
break;
}
+88
View File
@@ -3252,6 +3252,7 @@ class AlterRequest final :
kDropColumns = 3,
kChangeColumnTypes = 5,
kChangeTableOptions = 6,
kChangeColumnFulltext = 7,
KIND_NOT_SET = 0,
};
@@ -3339,6 +3340,7 @@ class AlterRequest final :
kDropColumnsFieldNumber = 3,
kChangeColumnTypesFieldNumber = 5,
kChangeTableOptionsFieldNumber = 6,
kChangeColumnFulltextFieldNumber = 7,
};
// uint64 region_id = 1;
void clear_region_id();
@@ -3430,6 +3432,24 @@ class AlterRequest final :
::greptime::v1::ChangeTableOptions* change_table_options);
::greptime::v1::ChangeTableOptions* unsafe_arena_release_change_table_options();
// .greptime.v1.ChangeColumnFulltext change_column_fulltext = 7;
bool has_change_column_fulltext() const;
private:
bool _internal_has_change_column_fulltext() const;
public:
void clear_change_column_fulltext();
const ::greptime::v1::ChangeColumnFulltext& change_column_fulltext() const;
PROTOBUF_NODISCARD ::greptime::v1::ChangeColumnFulltext* release_change_column_fulltext();
::greptime::v1::ChangeColumnFulltext* mutable_change_column_fulltext();
void set_allocated_change_column_fulltext(::greptime::v1::ChangeColumnFulltext* change_column_fulltext);
private:
const ::greptime::v1::ChangeColumnFulltext& _internal_change_column_fulltext() const;
::greptime::v1::ChangeColumnFulltext* _internal_mutable_change_column_fulltext();
public:
void unsafe_arena_set_allocated_change_column_fulltext(
::greptime::v1::ChangeColumnFulltext* change_column_fulltext);
::greptime::v1::ChangeColumnFulltext* unsafe_arena_release_change_column_fulltext();
void clear_kind();
KindCase kind_case() const;
// @@protoc_insertion_point(class_scope:greptime.v1.region.AlterRequest)
@@ -3439,6 +3459,7 @@ class AlterRequest final :
void set_has_drop_columns();
void set_has_change_column_types();
void set_has_change_table_options();
void set_has_change_column_fulltext();
inline bool has_kind() const;
inline void clear_has_kind();
@@ -3456,6 +3477,7 @@ class AlterRequest final :
::greptime::v1::region::DropColumns* drop_columns_;
::greptime::v1::ChangeColumnTypes* change_column_types_;
::greptime::v1::ChangeTableOptions* change_table_options_;
::greptime::v1::ChangeColumnFulltext* change_column_fulltext_;
} kind_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
uint32_t _oneof_case_[1];
@@ -7778,6 +7800,72 @@ inline ::greptime::v1::ChangeTableOptions* AlterRequest::mutable_change_table_op
return _msg;
}
// .greptime.v1.ChangeColumnFulltext change_column_fulltext = 7;
inline bool AlterRequest::_internal_has_change_column_fulltext() const {
return kind_case() == kChangeColumnFulltext;
}
inline bool AlterRequest::has_change_column_fulltext() const {
return _internal_has_change_column_fulltext();
}
inline void AlterRequest::set_has_change_column_fulltext() {
_impl_._oneof_case_[0] = kChangeColumnFulltext;
}
inline ::greptime::v1::ChangeColumnFulltext* AlterRequest::release_change_column_fulltext() {
// @@protoc_insertion_point(field_release:greptime.v1.region.AlterRequest.change_column_fulltext)
if (_internal_has_change_column_fulltext()) {
clear_has_kind();
::greptime::v1::ChangeColumnFulltext* temp = _impl_.kind_.change_column_fulltext_;
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
_impl_.kind_.change_column_fulltext_ = nullptr;
return temp;
} else {
return nullptr;
}
}
inline const ::greptime::v1::ChangeColumnFulltext& AlterRequest::_internal_change_column_fulltext() const {
return _internal_has_change_column_fulltext()
? *_impl_.kind_.change_column_fulltext_
: reinterpret_cast< ::greptime::v1::ChangeColumnFulltext&>(::greptime::v1::_ChangeColumnFulltext_default_instance_);
}
inline const ::greptime::v1::ChangeColumnFulltext& AlterRequest::change_column_fulltext() const {
// @@protoc_insertion_point(field_get:greptime.v1.region.AlterRequest.change_column_fulltext)
return _internal_change_column_fulltext();
}
inline ::greptime::v1::ChangeColumnFulltext* AlterRequest::unsafe_arena_release_change_column_fulltext() {
// @@protoc_insertion_point(field_unsafe_arena_release:greptime.v1.region.AlterRequest.change_column_fulltext)
if (_internal_has_change_column_fulltext()) {
clear_has_kind();
::greptime::v1::ChangeColumnFulltext* temp = _impl_.kind_.change_column_fulltext_;
_impl_.kind_.change_column_fulltext_ = nullptr;
return temp;
} else {
return nullptr;
}
}
inline void AlterRequest::unsafe_arena_set_allocated_change_column_fulltext(::greptime::v1::ChangeColumnFulltext* change_column_fulltext) {
clear_kind();
if (change_column_fulltext) {
set_has_change_column_fulltext();
_impl_.kind_.change_column_fulltext_ = change_column_fulltext;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:greptime.v1.region.AlterRequest.change_column_fulltext)
}
inline ::greptime::v1::ChangeColumnFulltext* AlterRequest::_internal_mutable_change_column_fulltext() {
if (!_internal_has_change_column_fulltext()) {
clear_kind();
set_has_change_column_fulltext();
_impl_.kind_.change_column_fulltext_ = CreateMaybeMessage< ::greptime::v1::ChangeColumnFulltext >(GetArenaForAllocation());
}
return _impl_.kind_.change_column_fulltext_;
}
inline ::greptime::v1::ChangeColumnFulltext* AlterRequest::mutable_change_column_fulltext() {
::greptime::v1::ChangeColumnFulltext* _msg = _internal_mutable_change_column_fulltext();
// @@protoc_insertion_point(field_mutable:greptime.v1.region.AlterRequest.change_column_fulltext)
return _msg;
}
// uint64 schema_version = 4;
inline void AlterRequest::clear_schema_version() {
_impl_.schema_version_ = uint64_t{0u};