feat: add fulltext options for column (#179)

* feat: add fulltext options for column

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

* feat: use string instead

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

* chore: polish

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

* chore: copy every where

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

* doc: polish

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

* extract as message

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

---------

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>
This commit is contained in:
Zhenchi
2024-07-09 04:07:34 +08:00
committed by GitHub
parent a70a6af9c6
commit b83f00958f
20 changed files with 3454 additions and 432 deletions
+79 -29
View File
@@ -40,6 +40,7 @@ PROTOBUF_CONSTEXPR ColumnSchema::ColumnSchema(
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_.column_name_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_.datatype_extension_)*/nullptr
, /*decltype(_impl_.options_)*/nullptr
, /*decltype(_impl_.datatype_)*/0
, /*decltype(_impl_.semantic_type_)*/0
, /*decltype(_impl_._cached_size_)*/{}} {}
@@ -104,6 +105,7 @@ const uint32_t TableStruct_greptime_2fv1_2frow_2eproto::offsets[] PROTOBUF_SECTI
PROTOBUF_FIELD_OFFSET(::greptime::v1::ColumnSchema, _impl_.datatype_),
PROTOBUF_FIELD_OFFSET(::greptime::v1::ColumnSchema, _impl_.semantic_type_),
PROTOBUF_FIELD_OFFSET(::greptime::v1::ColumnSchema, _impl_.datatype_extension_),
PROTOBUF_FIELD_OFFSET(::greptime::v1::ColumnSchema, _impl_.options_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::greptime::v1::Row, _internal_metadata_),
~0u, // no _extensions_
@@ -149,8 +151,8 @@ const uint32_t TableStruct_greptime_2fv1_2frow_2eproto::offsets[] PROTOBUF_SECTI
static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
{ 0, -1, -1, sizeof(::greptime::v1::Rows)},
{ 8, -1, -1, sizeof(::greptime::v1::ColumnSchema)},
{ 18, -1, -1, sizeof(::greptime::v1::Row)},
{ 25, -1, -1, sizeof(::greptime::v1::Value)},
{ 19, -1, -1, sizeof(::greptime::v1::Row)},
{ 26, -1, -1, sizeof(::greptime::v1::Value)},
};
static const ::_pb::Message* const file_default_instances[] = {
@@ -164,43 +166,44 @@ const char descriptor_table_protodef_greptime_2fv1_2frow_2eproto[] PROTOBUF_SECT
"\n\025greptime/v1/row.proto\022\013greptime.v1\032\030gr"
"eptime/v1/common.proto\"Q\n\004Rows\022)\n\006schema"
"\030\001 \003(\0132\031.greptime.v1.ColumnSchema\022\036\n\004row"
"s\030\002 \003(\0132\020.greptime.v1.Row\"\306\001\n\014ColumnSche"
"s\030\002 \003(\0132\020.greptime.v1.Row\"\363\001\n\014ColumnSche"
"ma\022\023\n\013column_name\030\001 \001(\t\022-\n\010datatype\030\002 \001("
"\0162\033.greptime.v1.ColumnDataType\0220\n\rsemant"
"ic_type\030\003 \001(\0162\031.greptime.v1.SemanticType"
"\022@\n\022datatype_extension\030\004 \001(\0132$.greptime."
"v1.ColumnDataTypeExtension\")\n\003Row\022\"\n\006val"
"ues\030\001 \003(\0132\022.greptime.v1.Value\"\274\006\n\005Value\022"
"\022\n\010i8_value\030\001 \001(\005H\000\022\023\n\ti16_value\030\002 \001(\005H\000"
"\022\023\n\ti32_value\030\003 \001(\005H\000\022\023\n\ti64_value\030\004 \001(\003"
"H\000\022\022\n\010u8_value\030\005 \001(\rH\000\022\023\n\tu16_value\030\006 \001("
"\rH\000\022\023\n\tu32_value\030\007 \001(\rH\000\022\023\n\tu64_value\030\010 "
"\001(\004H\000\022\023\n\tf32_value\030\t \001(\002H\000\022\023\n\tf64_value\030"
"\n \001(\001H\000\022\024\n\nbool_value\030\013 \001(\010H\000\022\026\n\014binary_"
"value\030\014 \001(\014H\000\022\026\n\014string_value\030\r \001(\tH\000\022\024\n"
"\ndate_value\030\016 \001(\005H\000\022\030\n\016datetime_value\030\017 "
"\001(\003H\000\022 \n\026timestamp_second_value\030\020 \001(\003H\000\022"
"%\n\033timestamp_millisecond_value\030\021 \001(\003H\000\022%"
"\n\033timestamp_microsecond_value\030\022 \001(\003H\000\022$\n"
"\032timestamp_nanosecond_value\030\023 \001(\003H\000\022\033\n\021t"
"ime_second_value\030\024 \001(\003H\000\022 \n\026time_millise"
"cond_value\030\025 \001(\003H\000\022 \n\026time_microsecond_v"
"alue\030\026 \001(\003H\000\022\037\n\025time_nanosecond_value\030\027 "
"\001(\003H\000\022#\n\031interval_year_month_value\030\030 \001(\005"
"H\000\022!\n\027interval_day_time_value\030\031 \001(\003H\000\022J\n"
"\035interval_month_day_nano_value\030\032 \001(\0132!.g"
"reptime.v1.IntervalMonthDayNanoH\000\0223\n\020dec"
"imal128_value\030\037 \001(\0132\027.greptime.v1.Decima"
"l128H\000B\014\n\nvalue_dataBP\n\016io.greptime.v1B\007"
"RowDataZ5github.com/GreptimeTeam/greptim"
"e-proto/go/greptime/v1b\006proto3"
"v1.ColumnDataTypeExtension\022+\n\007options\030\005 "
"\001(\0132\032.greptime.v1.ColumnOptions\")\n\003Row\022\""
"\n\006values\030\001 \003(\0132\022.greptime.v1.Value\"\274\006\n\005V"
"alue\022\022\n\010i8_value\030\001 \001(\005H\000\022\023\n\ti16_value\030\002 "
"\001(\005H\000\022\023\n\ti32_value\030\003 \001(\005H\000\022\023\n\ti64_value\030"
"\004 \001(\003H\000\022\022\n\010u8_value\030\005 \001(\rH\000\022\023\n\tu16_value"
"\030\006 \001(\rH\000\022\023\n\tu32_value\030\007 \001(\rH\000\022\023\n\tu64_val"
"ue\030\010 \001(\004H\000\022\023\n\tf32_value\030\t \001(\002H\000\022\023\n\tf64_v"
"alue\030\n \001(\001H\000\022\024\n\nbool_value\030\013 \001(\010H\000\022\026\n\014bi"
"nary_value\030\014 \001(\014H\000\022\026\n\014string_value\030\r \001(\t"
"H\000\022\024\n\ndate_value\030\016 \001(\005H\000\022\030\n\016datetime_val"
"ue\030\017 \001(\003H\000\022 \n\026timestamp_second_value\030\020 \001"
"(\003H\000\022%\n\033timestamp_millisecond_value\030\021 \001("
"\003H\000\022%\n\033timestamp_microsecond_value\030\022 \001(\003"
"H\000\022$\n\032timestamp_nanosecond_value\030\023 \001(\003H\000"
"\022\033\n\021time_second_value\030\024 \001(\003H\000\022 \n\026time_mi"
"llisecond_value\030\025 \001(\003H\000\022 \n\026time_microsec"
"ond_value\030\026 \001(\003H\000\022\037\n\025time_nanosecond_val"
"ue\030\027 \001(\003H\000\022#\n\031interval_year_month_value\030"
"\030 \001(\005H\000\022!\n\027interval_day_time_value\030\031 \001(\003"
"H\000\022J\n\035interval_month_day_nano_value\030\032 \001("
"\0132!.greptime.v1.IntervalMonthDayNanoH\000\0223"
"\n\020decimal128_value\030\037 \001(\0132\027.greptime.v1.D"
"ecimal128H\000B\014\n\nvalue_dataBP\n\016io.greptime"
".v1B\007RowDataZ5github.com/GreptimeTeam/gr"
"eptime-proto/go/greptime/v1b\006proto3"
;
static const ::_pbi::DescriptorTable* const descriptor_table_greptime_2fv1_2frow_2eproto_deps[1] = {
&::descriptor_table_greptime_2fv1_2fcommon_2eproto,
};
static ::_pbi::once_flag descriptor_table_greptime_2fv1_2frow_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_greptime_2fv1_2frow_2eproto = {
false, false, 1310, descriptor_table_protodef_greptime_2fv1_2frow_2eproto,
false, false, 1355, descriptor_table_protodef_greptime_2fv1_2frow_2eproto,
"greptime/v1/row.proto",
&descriptor_table_greptime_2fv1_2frow_2eproto_once, descriptor_table_greptime_2fv1_2frow_2eproto_deps, 1, 4,
schemas, file_default_instances, TableStruct_greptime_2fv1_2frow_2eproto::offsets,
@@ -440,18 +443,29 @@ void Rows::InternalSwap(Rows* other) {
class ColumnSchema::_Internal {
public:
static const ::greptime::v1::ColumnDataTypeExtension& datatype_extension(const ColumnSchema* msg);
static const ::greptime::v1::ColumnOptions& options(const ColumnSchema* msg);
};
const ::greptime::v1::ColumnDataTypeExtension&
ColumnSchema::_Internal::datatype_extension(const ColumnSchema* msg) {
return *msg->_impl_.datatype_extension_;
}
const ::greptime::v1::ColumnOptions&
ColumnSchema::_Internal::options(const ColumnSchema* msg) {
return *msg->_impl_.options_;
}
void ColumnSchema::clear_datatype_extension() {
if (GetArenaForAllocation() == nullptr && _impl_.datatype_extension_ != nullptr) {
delete _impl_.datatype_extension_;
}
_impl_.datatype_extension_ = nullptr;
}
void ColumnSchema::clear_options() {
if (GetArenaForAllocation() == nullptr && _impl_.options_ != nullptr) {
delete _impl_.options_;
}
_impl_.options_ = nullptr;
}
ColumnSchema::ColumnSchema(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
@@ -464,6 +478,7 @@ ColumnSchema::ColumnSchema(const ColumnSchema& from)
new (&_impl_) Impl_{
decltype(_impl_.column_name_){}
, decltype(_impl_.datatype_extension_){nullptr}
, decltype(_impl_.options_){nullptr}
, decltype(_impl_.datatype_){}
, decltype(_impl_.semantic_type_){}
, /*decltype(_impl_._cached_size_)*/{}};
@@ -480,6 +495,9 @@ ColumnSchema::ColumnSchema(const ColumnSchema& from)
if (from._internal_has_datatype_extension()) {
_this->_impl_.datatype_extension_ = new ::greptime::v1::ColumnDataTypeExtension(*from._impl_.datatype_extension_);
}
if (from._internal_has_options()) {
_this->_impl_.options_ = new ::greptime::v1::ColumnOptions(*from._impl_.options_);
}
::memcpy(&_impl_.datatype_, &from._impl_.datatype_,
static_cast<size_t>(reinterpret_cast<char*>(&_impl_.semantic_type_) -
reinterpret_cast<char*>(&_impl_.datatype_)) + sizeof(_impl_.semantic_type_));
@@ -493,6 +511,7 @@ inline void ColumnSchema::SharedCtor(
new (&_impl_) Impl_{
decltype(_impl_.column_name_){}
, decltype(_impl_.datatype_extension_){nullptr}
, decltype(_impl_.options_){nullptr}
, decltype(_impl_.datatype_){0}
, decltype(_impl_.semantic_type_){0}
, /*decltype(_impl_._cached_size_)*/{}
@@ -516,6 +535,7 @@ inline void ColumnSchema::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
_impl_.column_name_.Destroy();
if (this != internal_default_instance()) delete _impl_.datatype_extension_;
if (this != internal_default_instance()) delete _impl_.options_;
}
void ColumnSchema::SetCachedSize(int size) const {
@@ -533,6 +553,10 @@ void ColumnSchema::Clear() {
delete _impl_.datatype_extension_;
}
_impl_.datatype_extension_ = nullptr;
if (GetArenaForAllocation() == nullptr && _impl_.options_ != nullptr) {
delete _impl_.options_;
}
_impl_.options_ = nullptr;
::memset(&_impl_.datatype_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&_impl_.semantic_type_) -
reinterpret_cast<char*>(&_impl_.datatype_)) + sizeof(_impl_.semantic_type_));
@@ -581,6 +605,14 @@ const char* ColumnSchema::_InternalParse(const char* ptr, ::_pbi::ParseContext*
} else
goto handle_unusual;
continue;
// .greptime.v1.ColumnOptions options = 5;
case 5:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
default:
goto handle_unusual;
} // switch
@@ -641,6 +673,13 @@ uint8_t* ColumnSchema::_InternalSerialize(
_Internal::datatype_extension(this).GetCachedSize(), target, stream);
}
// .greptime.v1.ColumnOptions options = 5;
if (this->_internal_has_options()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(5, _Internal::options(this),
_Internal::options(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);
@@ -671,6 +710,13 @@ size_t ColumnSchema::ByteSizeLong() const {
*_impl_.datatype_extension_);
}
// .greptime.v1.ColumnOptions options = 5;
if (this->_internal_has_options()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.options_);
}
// .greptime.v1.ColumnDataType datatype = 2;
if (this->_internal_datatype() != 0) {
total_size += 1 +
@@ -708,6 +754,10 @@ void ColumnSchema::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::P
_this->_internal_mutable_datatype_extension()->::greptime::v1::ColumnDataTypeExtension::MergeFrom(
from._internal_datatype_extension());
}
if (from._internal_has_options()) {
_this->_internal_mutable_options()->::greptime::v1::ColumnOptions::MergeFrom(
from._internal_options());
}
if (from._internal_datatype() != 0) {
_this->_internal_set_datatype(from._internal_datatype());
}