From b1d403088f02136bcebde53d604f491c260ca8e2 Mon Sep 17 00:00:00 2001 From: Zhenchi Date: Tue, 5 Dec 2023 10:42:43 +0800 Subject: [PATCH] feat(inverted_index): add row count to metas (#126) Signed-off-by: Zhenchi --- c++/greptime/v1/index/inverted_index.pb.cc | 141 +++++--- c++/greptime/v1/index/inverted_index.pb.h | 93 +++-- .../main/java/io/greptime/v1/index/Index.java | 335 +++++++++++------- proto/greptime/v1/index/inverted_index.proto | 14 +- 4 files changed, 377 insertions(+), 206 deletions(-) diff --git a/c++/greptime/v1/index/inverted_index.pb.cc b/c++/greptime/v1/index/inverted_index.pb.cc index 64b9a204..4305078f 100644 --- a/c++/greptime/v1/index/inverted_index.pb.cc +++ b/c++/greptime/v1/index/inverted_index.pb.cc @@ -37,6 +37,8 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORIT PROTOBUF_CONSTEXPR InvertedIndexMetas::InvertedIndexMetas( ::_pbi::ConstantInitialized): _impl_{ /*decltype(_impl_.metas_)*/{::_pbi::ConstantInitialized()} + , /*decltype(_impl_.total_row_count_)*/uint64_t{0u} + , /*decltype(_impl_.segment_row_count_)*/uint64_t{0u} , /*decltype(_impl_._cached_size_)*/{}} {} struct InvertedIndexMetasDefaultTypeInternal { PROTOBUF_CONSTEXPR InvertedIndexMetasDefaultTypeInternal() @@ -57,7 +59,6 @@ PROTOBUF_CONSTEXPR InvertedIndexMeta::InvertedIndexMeta( , /*decltype(_impl_.fst_size_)*/0u , /*decltype(_impl_.relative_null_bitmap_offset_)*/0u , /*decltype(_impl_.null_bitmap_size_)*/0u - , /*decltype(_impl_.segment_row_count_)*/uint64_t{0u} , /*decltype(_impl_._cached_size_)*/{}} {} struct InvertedIndexMetaDefaultTypeInternal { PROTOBUF_CONSTEXPR InvertedIndexMetaDefaultTypeInternal() @@ -109,6 +110,8 @@ const uint32_t TableStruct_greptime_2fv1_2findex_2finverted_5findex_2eproto::off ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ PROTOBUF_FIELD_OFFSET(::greptime::v1::index::InvertedIndexMetas, _impl_.metas_), + PROTOBUF_FIELD_OFFSET(::greptime::v1::index::InvertedIndexMetas, _impl_.total_row_count_), + PROTOBUF_FIELD_OFFSET(::greptime::v1::index::InvertedIndexMetas, _impl_.segment_row_count_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::greptime::v1::index::InvertedIndexMeta, _internal_metadata_), ~0u, // no _extensions_ @@ -123,7 +126,6 @@ const uint32_t TableStruct_greptime_2fv1_2findex_2finverted_5findex_2eproto::off PROTOBUF_FIELD_OFFSET(::greptime::v1::index::InvertedIndexMeta, _impl_.relative_null_bitmap_offset_), PROTOBUF_FIELD_OFFSET(::greptime::v1::index::InvertedIndexMeta, _impl_.null_bitmap_size_), PROTOBUF_FIELD_OFFSET(::greptime::v1::index::InvertedIndexMeta, _impl_.stats_), - PROTOBUF_FIELD_OFFSET(::greptime::v1::index::InvertedIndexMeta, _impl_.segment_row_count_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::greptime::v1::index::InvertedIndexStats, _internal_metadata_), ~0u, // no _extensions_ @@ -138,8 +140,8 @@ const uint32_t TableStruct_greptime_2fv1_2findex_2finverted_5findex_2eproto::off static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, 8, -1, sizeof(::greptime::v1::index::InvertedIndexMetas_MetasEntry_DoNotUse)}, { 10, -1, -1, sizeof(::greptime::v1::index::InvertedIndexMetas)}, - { 17, -1, -1, sizeof(::greptime::v1::index::InvertedIndexMeta)}, - { 32, -1, -1, sizeof(::greptime::v1::index::InvertedIndexStats)}, + { 19, -1, -1, sizeof(::greptime::v1::index::InvertedIndexMeta)}, + { 33, -1, -1, sizeof(::greptime::v1::index::InvertedIndexStats)}, }; static const ::_pb::Message* const file_default_instances[] = { @@ -151,27 +153,28 @@ static const ::_pb::Message* const file_default_instances[] = { const char descriptor_table_protodef_greptime_2fv1_2findex_2finverted_5findex_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = "\n&greptime/v1/index/inverted_index.proto" - "\022\021greptime.v1.index\"\251\001\n\022InvertedIndexMet" + "\022\021greptime.v1.index\"\335\001\n\022InvertedIndexMet" "as\022\?\n\005metas\030\001 \003(\01320.greptime.v1.index.In" - "vertedIndexMetas.MetasEntry\032R\n\nMetasEntr" - "y\022\013\n\003key\030\001 \001(\t\0223\n\005value\030\002 \001(\0132$.greptime" - ".v1.index.InvertedIndexMeta:\0028\001\"\222\002\n\021Inve" - "rtedIndexMeta\022\014\n\004name\030\001 \001(\t\022\023\n\013base_offs" - "et\030\002 \001(\004\022\033\n\023inverted_index_size\030\003 \001(\004\022\033\n" - "\023relative_fst_offset\030\004 \001(\r\022\020\n\010fst_size\030\005" - " \001(\r\022#\n\033relative_null_bitmap_offset\030\006 \001(" - "\r\022\030\n\020null_bitmap_size\030\007 \001(\r\0224\n\005stats\030\010 \001" - "(\0132%.greptime.v1.index.InvertedIndexStat" - "s\022\031\n\021segment_row_count\030\t \001(\004\"f\n\022Inverted" - "IndexStats\022\022\n\nnull_count\030\001 \001(\004\022\026\n\016distin" - "ct_count\030\002 \001(\004\022\021\n\tmin_value\030\003 \001(\014\022\021\n\tmax" - "_value\030\004 \001(\014BZ\n\024io.greptime.v1.indexB\005In" - "dexZ;github.com/GreptimeTeam/greptime-pr" - "oto/go/greptime/v1/indexb\006proto3" + "vertedIndexMetas.MetasEntry\022\027\n\017total_row" + "_count\030\002 \001(\004\022\031\n\021segment_row_count\030\003 \001(\004\032" + "R\n\nMetasEntry\022\013\n\003key\030\001 \001(\t\0223\n\005value\030\002 \001(" + "\0132$.greptime.v1.index.InvertedIndexMeta:" + "\0028\001\"\367\001\n\021InvertedIndexMeta\022\014\n\004name\030\001 \001(\t\022" + "\023\n\013base_offset\030\002 \001(\004\022\033\n\023inverted_index_s" + "ize\030\003 \001(\004\022\033\n\023relative_fst_offset\030\004 \001(\r\022\020" + "\n\010fst_size\030\005 \001(\r\022#\n\033relative_null_bitmap" + "_offset\030\006 \001(\r\022\030\n\020null_bitmap_size\030\007 \001(\r\022" + "4\n\005stats\030\010 \001(\0132%.greptime.v1.index.Inver" + "tedIndexStats\"f\n\022InvertedIndexStats\022\022\n\nn" + "ull_count\030\001 \001(\004\022\026\n\016distinct_count\030\002 \001(\004\022" + "\021\n\tmin_value\030\003 \001(\014\022\021\n\tmax_value\030\004 \001(\014BZ\n" + "\024io.greptime.v1.indexB\005IndexZ;github.com" + "/GreptimeTeam/greptime-proto/go/greptime" + "/v1/indexb\006proto3" ; static ::_pbi::once_flag descriptor_table_greptime_2fv1_2findex_2finverted_5findex_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_greptime_2fv1_2findex_2finverted_5findex_2eproto = { - false, false, 712, descriptor_table_protodef_greptime_2fv1_2findex_2finverted_5findex_2eproto, + false, false, 737, descriptor_table_protodef_greptime_2fv1_2findex_2finverted_5findex_2eproto, "greptime/v1/index/inverted_index.proto", &descriptor_table_greptime_2fv1_2findex_2finverted_5findex_2eproto_once, nullptr, 0, 4, schemas, file_default_instances, TableStruct_greptime_2fv1_2findex_2finverted_5findex_2eproto::offsets, @@ -222,10 +225,15 @@ InvertedIndexMetas::InvertedIndexMetas(const InvertedIndexMetas& from) InvertedIndexMetas* const _this = this; (void)_this; new (&_impl_) Impl_{ /*decltype(_impl_.metas_)*/{} + , decltype(_impl_.total_row_count_){} + , decltype(_impl_.segment_row_count_){} , /*decltype(_impl_._cached_size_)*/{}}; _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _this->_impl_.metas_.MergeFrom(from._impl_.metas_); + ::memcpy(&_impl_.total_row_count_, &from._impl_.total_row_count_, + static_cast(reinterpret_cast(&_impl_.segment_row_count_) - + reinterpret_cast(&_impl_.total_row_count_)) + sizeof(_impl_.segment_row_count_)); // @@protoc_insertion_point(copy_constructor:greptime.v1.index.InvertedIndexMetas) } @@ -235,6 +243,8 @@ inline void InvertedIndexMetas::SharedCtor( (void)is_message_owned; new (&_impl_) Impl_{ /*decltype(_impl_.metas_)*/{::_pbi::ArenaInitialized(), arena} + , decltype(_impl_.total_row_count_){uint64_t{0u}} + , decltype(_impl_.segment_row_count_){uint64_t{0u}} , /*decltype(_impl_._cached_size_)*/{} }; } @@ -270,6 +280,9 @@ void InvertedIndexMetas::Clear() { (void) cached_has_bits; _impl_.metas_.Clear(); + ::memset(&_impl_.total_row_count_, 0, static_cast( + reinterpret_cast(&_impl_.segment_row_count_) - + reinterpret_cast(&_impl_.total_row_count_)) + sizeof(_impl_.segment_row_count_)); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } @@ -292,6 +305,22 @@ const char* InvertedIndexMetas::_InternalParse(const char* ptr, ::_pbi::ParseCon } else goto handle_unusual; continue; + // uint64 total_row_count = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _impl_.total_row_count_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint64 segment_row_count = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _impl_.segment_row_count_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -347,6 +376,18 @@ uint8_t* InvertedIndexMetas::_InternalSerialize( } } + // uint64 total_row_count = 2; + if (this->_internal_total_row_count() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt64ToArray(2, this->_internal_total_row_count(), target); + } + + // uint64 segment_row_count = 3; + if (this->_internal_segment_row_count() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt64ToArray(3, this->_internal_segment_row_count(), 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); @@ -372,6 +413,16 @@ size_t InvertedIndexMetas::ByteSizeLong() const { total_size += InvertedIndexMetas_MetasEntry_DoNotUse::Funcs::ByteSizeLong(it->first, it->second); } + // uint64 total_row_count = 2; + if (this->_internal_total_row_count() != 0) { + total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_total_row_count()); + } + + // uint64 segment_row_count = 3; + if (this->_internal_segment_row_count() != 0) { + total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_segment_row_count()); + } + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } @@ -391,6 +442,12 @@ void InvertedIndexMetas::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, con (void) cached_has_bits; _this->_impl_.metas_.MergeFrom(from._impl_.metas_); + if (from._internal_total_row_count() != 0) { + _this->_internal_set_total_row_count(from._internal_total_row_count()); + } + if (from._internal_segment_row_count() != 0) { + _this->_internal_set_segment_row_count(from._internal_segment_row_count()); + } _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -409,6 +466,12 @@ void InvertedIndexMetas::InternalSwap(InvertedIndexMetas* other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); _impl_.metas_.InternalSwap(&other->_impl_.metas_); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(InvertedIndexMetas, _impl_.segment_row_count_) + + sizeof(InvertedIndexMetas::_impl_.segment_row_count_) + - PROTOBUF_FIELD_OFFSET(InvertedIndexMetas, _impl_.total_row_count_)>( + reinterpret_cast(&_impl_.total_row_count_), + reinterpret_cast(&other->_impl_.total_row_count_)); } ::PROTOBUF_NAMESPACE_ID::Metadata InvertedIndexMetas::GetMetadata() const { @@ -446,7 +509,6 @@ InvertedIndexMeta::InvertedIndexMeta(const InvertedIndexMeta& from) , decltype(_impl_.fst_size_){} , decltype(_impl_.relative_null_bitmap_offset_){} , decltype(_impl_.null_bitmap_size_){} - , decltype(_impl_.segment_row_count_){} , /*decltype(_impl_._cached_size_)*/{}}; _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); @@ -462,8 +524,8 @@ InvertedIndexMeta::InvertedIndexMeta(const InvertedIndexMeta& from) _this->_impl_.stats_ = new ::greptime::v1::index::InvertedIndexStats(*from._impl_.stats_); } ::memcpy(&_impl_.base_offset_, &from._impl_.base_offset_, - static_cast(reinterpret_cast(&_impl_.segment_row_count_) - - reinterpret_cast(&_impl_.base_offset_)) + sizeof(_impl_.segment_row_count_)); + static_cast(reinterpret_cast(&_impl_.null_bitmap_size_) - + reinterpret_cast(&_impl_.base_offset_)) + sizeof(_impl_.null_bitmap_size_)); // @@protoc_insertion_point(copy_constructor:greptime.v1.index.InvertedIndexMeta) } @@ -480,7 +542,6 @@ inline void InvertedIndexMeta::SharedCtor( , decltype(_impl_.fst_size_){0u} , decltype(_impl_.relative_null_bitmap_offset_){0u} , decltype(_impl_.null_bitmap_size_){0u} - , decltype(_impl_.segment_row_count_){uint64_t{0u}} , /*decltype(_impl_._cached_size_)*/{} }; _impl_.name_.InitDefault(); @@ -520,8 +581,8 @@ void InvertedIndexMeta::Clear() { } _impl_.stats_ = nullptr; ::memset(&_impl_.base_offset_, 0, static_cast( - reinterpret_cast(&_impl_.segment_row_count_) - - reinterpret_cast(&_impl_.base_offset_)) + sizeof(_impl_.segment_row_count_)); + reinterpret_cast(&_impl_.null_bitmap_size_) - + reinterpret_cast(&_impl_.base_offset_)) + sizeof(_impl_.null_bitmap_size_)); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } @@ -597,14 +658,6 @@ const char* InvertedIndexMeta::_InternalParse(const char* ptr, ::_pbi::ParseCont } else goto handle_unusual; continue; - // uint64 segment_row_count = 9; - case 9: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 72)) { - _impl_.segment_row_count_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); - CHK_(ptr); - } else - goto handle_unusual; - continue; default: goto handle_unusual; } // switch @@ -687,12 +740,6 @@ uint8_t* InvertedIndexMeta::_InternalSerialize( _Internal::stats(this).GetCachedSize(), target, stream); } - // uint64 segment_row_count = 9; - if (this->_internal_segment_row_count() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray(9, this->_internal_segment_row_count(), 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); @@ -753,11 +800,6 @@ size_t InvertedIndexMeta::ByteSizeLong() const { total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_null_bitmap_size()); } - // uint64 segment_row_count = 9; - if (this->_internal_segment_row_count() != 0) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_segment_row_count()); - } - return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } @@ -801,9 +843,6 @@ void InvertedIndexMeta::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, cons if (from._internal_null_bitmap_size() != 0) { _this->_internal_set_null_bitmap_size(from._internal_null_bitmap_size()); } - if (from._internal_segment_row_count() != 0) { - _this->_internal_set_segment_row_count(from._internal_segment_row_count()); - } _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -828,8 +867,8 @@ void InvertedIndexMeta::InternalSwap(InvertedIndexMeta* other) { &other->_impl_.name_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(InvertedIndexMeta, _impl_.segment_row_count_) - + sizeof(InvertedIndexMeta::_impl_.segment_row_count_) + PROTOBUF_FIELD_OFFSET(InvertedIndexMeta, _impl_.null_bitmap_size_) + + sizeof(InvertedIndexMeta::_impl_.null_bitmap_size_) - PROTOBUF_FIELD_OFFSET(InvertedIndexMeta, _impl_.stats_)>( reinterpret_cast(&_impl_.stats_), reinterpret_cast(&other->_impl_.stats_)); diff --git a/c++/greptime/v1/index/inverted_index.pb.h b/c++/greptime/v1/index/inverted_index.pb.h index 91efa3cd..78434164 100644 --- a/c++/greptime/v1/index/inverted_index.pb.h +++ b/c++/greptime/v1/index/inverted_index.pb.h @@ -228,6 +228,8 @@ class InvertedIndexMetas final : enum : int { kMetasFieldNumber = 1, + kTotalRowCountFieldNumber = 2, + kSegmentRowCountFieldNumber = 3, }; // map metas = 1; int metas_size() const; @@ -246,6 +248,24 @@ class InvertedIndexMetas final : ::PROTOBUF_NAMESPACE_ID::Map< std::string, ::greptime::v1::index::InvertedIndexMeta >* mutable_metas(); + // uint64 total_row_count = 2; + void clear_total_row_count(); + uint64_t total_row_count() const; + void set_total_row_count(uint64_t value); + private: + uint64_t _internal_total_row_count() const; + void _internal_set_total_row_count(uint64_t value); + public: + + // uint64 segment_row_count = 3; + void clear_segment_row_count(); + uint64_t segment_row_count() const; + void set_segment_row_count(uint64_t value); + private: + uint64_t _internal_segment_row_count() const; + void _internal_set_segment_row_count(uint64_t value); + public: + // @@protoc_insertion_point(class_scope:greptime.v1.index.InvertedIndexMetas) private: class _Internal; @@ -259,6 +279,8 @@ class InvertedIndexMetas final : std::string, ::greptime::v1::index::InvertedIndexMeta, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_STRING, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_MESSAGE> metas_; + uint64_t total_row_count_; + uint64_t segment_row_count_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union { Impl_ _impl_; }; @@ -395,7 +417,6 @@ class InvertedIndexMeta final : kFstSizeFieldNumber = 5, kRelativeNullBitmapOffsetFieldNumber = 6, kNullBitmapSizeFieldNumber = 7, - kSegmentRowCountFieldNumber = 9, }; // string name = 1; void clear_name(); @@ -483,15 +504,6 @@ class InvertedIndexMeta final : void _internal_set_null_bitmap_size(uint32_t value); public: - // uint64 segment_row_count = 9; - void clear_segment_row_count(); - uint64_t segment_row_count() const; - void set_segment_row_count(uint64_t value); - private: - uint64_t _internal_segment_row_count() const; - void _internal_set_segment_row_count(uint64_t value); - public: - // @@protoc_insertion_point(class_scope:greptime.v1.index.InvertedIndexMeta) private: class _Internal; @@ -508,7 +520,6 @@ class InvertedIndexMeta final : uint32_t fst_size_; uint32_t relative_null_bitmap_offset_; uint32_t null_bitmap_size_; - uint64_t segment_row_count_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union { Impl_ _impl_; }; @@ -747,6 +758,46 @@ InvertedIndexMetas::mutable_metas() { return _internal_mutable_metas(); } +// uint64 total_row_count = 2; +inline void InvertedIndexMetas::clear_total_row_count() { + _impl_.total_row_count_ = uint64_t{0u}; +} +inline uint64_t InvertedIndexMetas::_internal_total_row_count() const { + return _impl_.total_row_count_; +} +inline uint64_t InvertedIndexMetas::total_row_count() const { + // @@protoc_insertion_point(field_get:greptime.v1.index.InvertedIndexMetas.total_row_count) + return _internal_total_row_count(); +} +inline void InvertedIndexMetas::_internal_set_total_row_count(uint64_t value) { + + _impl_.total_row_count_ = value; +} +inline void InvertedIndexMetas::set_total_row_count(uint64_t value) { + _internal_set_total_row_count(value); + // @@protoc_insertion_point(field_set:greptime.v1.index.InvertedIndexMetas.total_row_count) +} + +// uint64 segment_row_count = 3; +inline void InvertedIndexMetas::clear_segment_row_count() { + _impl_.segment_row_count_ = uint64_t{0u}; +} +inline uint64_t InvertedIndexMetas::_internal_segment_row_count() const { + return _impl_.segment_row_count_; +} +inline uint64_t InvertedIndexMetas::segment_row_count() const { + // @@protoc_insertion_point(field_get:greptime.v1.index.InvertedIndexMetas.segment_row_count) + return _internal_segment_row_count(); +} +inline void InvertedIndexMetas::_internal_set_segment_row_count(uint64_t value) { + + _impl_.segment_row_count_ = value; +} +inline void InvertedIndexMetas::set_segment_row_count(uint64_t value) { + _internal_set_segment_row_count(value); + // @@protoc_insertion_point(field_set:greptime.v1.index.InvertedIndexMetas.segment_row_count) +} + // ------------------------------------------------------------------- // InvertedIndexMeta @@ -1011,26 +1062,6 @@ inline void InvertedIndexMeta::set_allocated_stats(::greptime::v1::index::Invert // @@protoc_insertion_point(field_set_allocated:greptime.v1.index.InvertedIndexMeta.stats) } -// uint64 segment_row_count = 9; -inline void InvertedIndexMeta::clear_segment_row_count() { - _impl_.segment_row_count_ = uint64_t{0u}; -} -inline uint64_t InvertedIndexMeta::_internal_segment_row_count() const { - return _impl_.segment_row_count_; -} -inline uint64_t InvertedIndexMeta::segment_row_count() const { - // @@protoc_insertion_point(field_get:greptime.v1.index.InvertedIndexMeta.segment_row_count) - return _internal_segment_row_count(); -} -inline void InvertedIndexMeta::_internal_set_segment_row_count(uint64_t value) { - - _impl_.segment_row_count_ = value; -} -inline void InvertedIndexMeta::set_segment_row_count(uint64_t value) { - _internal_set_segment_row_count(value); - // @@protoc_insertion_point(field_set:greptime.v1.index.InvertedIndexMeta.segment_row_count) -} - // ------------------------------------------------------------------- // InvertedIndexStats diff --git a/java/src/main/java/io/greptime/v1/index/Index.java b/java/src/main/java/io/greptime/v1/index/Index.java index 33a0b2ca..92e2e774 100644 --- a/java/src/main/java/io/greptime/v1/index/Index.java +++ b/java/src/main/java/io/greptime/v1/index/Index.java @@ -78,6 +78,29 @@ io.greptime.v1.index.Index.InvertedIndexMeta getMetasOrDefault( io.greptime.v1.index.Index.InvertedIndexMeta getMetasOrThrow( java.lang.String key); + + /** + *
+     * The total count of rows within the inverted index blob.
+     * This is used to determine the number of segments within the bitmap.
+     * 
+ * + * uint64 total_row_count = 2; + * @return The totalRowCount. + */ + long getTotalRowCount(); + + /** + *
+     * The number of rows per group for bitmap indexing which determines how rows are
+     * batched for indexing. Each batch corresponds to a segment in the bitmap and allows
+     * for efficient retrieval during queries by reducing the search space.
+     * 
+ * + * uint64 segment_row_count = 3; + * @return The segmentRowCount. + */ + long getSegmentRowCount(); } /** *
@@ -143,6 +166,16 @@ private InvertedIndexMetas(
                   metas__.getKey(), metas__.getValue());
               break;
             }
+            case 16: {
+
+              totalRowCount_ = input.readUInt64();
+              break;
+            }
+            case 24: {
+
+              segmentRowCount_ = input.readUInt64();
+              break;
+            }
             default: {
               if (!parseUnknownField(
                   input, unknownFields, extensionRegistry, tag)) {
@@ -290,6 +323,39 @@ public io.greptime.v1.index.Index.InvertedIndexMeta getMetasOrThrow(
       return map.get(key);
     }
 
+    public static final int TOTAL_ROW_COUNT_FIELD_NUMBER = 2;
+    private long totalRowCount_;
+    /**
+     * 
+     * The total count of rows within the inverted index blob.
+     * This is used to determine the number of segments within the bitmap.
+     * 
+ * + * uint64 total_row_count = 2; + * @return The totalRowCount. + */ + @java.lang.Override + public long getTotalRowCount() { + return totalRowCount_; + } + + public static final int SEGMENT_ROW_COUNT_FIELD_NUMBER = 3; + private long segmentRowCount_; + /** + *
+     * The number of rows per group for bitmap indexing which determines how rows are
+     * batched for indexing. Each batch corresponds to a segment in the bitmap and allows
+     * for efficient retrieval during queries by reducing the search space.
+     * 
+ * + * uint64 segment_row_count = 3; + * @return The segmentRowCount. + */ + @java.lang.Override + public long getSegmentRowCount() { + return segmentRowCount_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -310,6 +376,12 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) internalGetMetas(), MetasDefaultEntryHolder.defaultEntry, 1); + if (totalRowCount_ != 0L) { + output.writeUInt64(2, totalRowCount_); + } + if (segmentRowCount_ != 0L) { + output.writeUInt64(3, segmentRowCount_); + } unknownFields.writeTo(output); } @@ -329,6 +401,14 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, metas__); } + if (totalRowCount_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(2, totalRowCount_); + } + if (segmentRowCount_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(3, segmentRowCount_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -346,6 +426,10 @@ public boolean equals(final java.lang.Object obj) { if (!internalGetMetas().equals( other.internalGetMetas())) return false; + if (getTotalRowCount() + != other.getTotalRowCount()) return false; + if (getSegmentRowCount() + != other.getSegmentRowCount()) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -361,6 +445,12 @@ public int hashCode() { hash = (37 * hash) + METAS_FIELD_NUMBER; hash = (53 * hash) + internalGetMetas().hashCode(); } + hash = (37 * hash) + TOTAL_ROW_COUNT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTotalRowCount()); + hash = (37 * hash) + SEGMENT_ROW_COUNT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getSegmentRowCount()); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -522,6 +612,10 @@ private void maybeForceBuilderInitialization() { public Builder clear() { super.clear(); internalGetMutableMetas().clear(); + totalRowCount_ = 0L; + + segmentRowCount_ = 0L; + return this; } @@ -551,6 +645,8 @@ public io.greptime.v1.index.Index.InvertedIndexMetas buildPartial() { int from_bitField0_ = bitField0_; result.metas_ = internalGetMetas(); result.metas_.makeImmutable(); + result.totalRowCount_ = totalRowCount_; + result.segmentRowCount_ = segmentRowCount_; onBuilt(); return result; } @@ -601,6 +697,12 @@ public Builder mergeFrom(io.greptime.v1.index.Index.InvertedIndexMetas other) { if (other == io.greptime.v1.index.Index.InvertedIndexMetas.getDefaultInstance()) return this; internalGetMutableMetas().mergeFrom( other.internalGetMetas()); + if (other.getTotalRowCount() != 0L) { + setTotalRowCount(other.getTotalRowCount()); + } + if (other.getSegmentRowCount() != 0L) { + setSegmentRowCount(other.getSegmentRowCount()); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -796,6 +898,101 @@ public Builder putAllMetas( .putAll(values); return this; } + + private long totalRowCount_ ; + /** + *
+       * The total count of rows within the inverted index blob.
+       * This is used to determine the number of segments within the bitmap.
+       * 
+ * + * uint64 total_row_count = 2; + * @return The totalRowCount. + */ + @java.lang.Override + public long getTotalRowCount() { + return totalRowCount_; + } + /** + *
+       * The total count of rows within the inverted index blob.
+       * This is used to determine the number of segments within the bitmap.
+       * 
+ * + * uint64 total_row_count = 2; + * @param value The totalRowCount to set. + * @return This builder for chaining. + */ + public Builder setTotalRowCount(long value) { + + totalRowCount_ = value; + onChanged(); + return this; + } + /** + *
+       * The total count of rows within the inverted index blob.
+       * This is used to determine the number of segments within the bitmap.
+       * 
+ * + * uint64 total_row_count = 2; + * @return This builder for chaining. + */ + public Builder clearTotalRowCount() { + + totalRowCount_ = 0L; + onChanged(); + return this; + } + + private long segmentRowCount_ ; + /** + *
+       * The number of rows per group for bitmap indexing which determines how rows are
+       * batched for indexing. Each batch corresponds to a segment in the bitmap and allows
+       * for efficient retrieval during queries by reducing the search space.
+       * 
+ * + * uint64 segment_row_count = 3; + * @return The segmentRowCount. + */ + @java.lang.Override + public long getSegmentRowCount() { + return segmentRowCount_; + } + /** + *
+       * The number of rows per group for bitmap indexing which determines how rows are
+       * batched for indexing. Each batch corresponds to a segment in the bitmap and allows
+       * for efficient retrieval during queries by reducing the search space.
+       * 
+ * + * uint64 segment_row_count = 3; + * @param value The segmentRowCount to set. + * @return This builder for chaining. + */ + public Builder setSegmentRowCount(long value) { + + segmentRowCount_ = value; + onChanged(); + return this; + } + /** + *
+       * The number of rows per group for bitmap indexing which determines how rows are
+       * batched for indexing. Each batch corresponds to a segment in the bitmap and allows
+       * for efficient retrieval during queries by reducing the search space.
+       * 
+ * + * uint64 segment_row_count = 3; + * @return This builder for chaining. + */ + public Builder clearSegmentRowCount() { + + segmentRowCount_ = 0L; + onChanged(); + return this; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { @@ -962,18 +1159,6 @@ public interface InvertedIndexMetaOrBuilder extends * .greptime.v1.index.InvertedIndexStats stats = 8; */ io.greptime.v1.index.Index.InvertedIndexStatsOrBuilder getStatsOrBuilder(); - - /** - *
-     * The number of rows per group for bitmap indexing which determines how rows are
-     * batched for indexing. Each batch corresponds to a segment in the bitmap and allows
-     * for efficient retrieval during queries by reducing the search space.
-     * 
- * - * uint64 segment_row_count = 9; - * @return The segmentRowCount. - */ - long getSegmentRowCount(); } /** *
@@ -1074,11 +1259,6 @@ private InvertedIndexMeta(
 
               break;
             }
-            case 72: {
-
-              segmentRowCount_ = input.readUInt64();
-              break;
-            }
             default: {
               if (!parseUnknownField(
                   input, unknownFields, extensionRegistry, tag)) {
@@ -1290,23 +1470,6 @@ public io.greptime.v1.index.Index.InvertedIndexStatsOrBuilder getStatsOrBuilder(
       return getStats();
     }
 
-    public static final int SEGMENT_ROW_COUNT_FIELD_NUMBER = 9;
-    private long segmentRowCount_;
-    /**
-     * 
-     * The number of rows per group for bitmap indexing which determines how rows are
-     * batched for indexing. Each batch corresponds to a segment in the bitmap and allows
-     * for efficient retrieval during queries by reducing the search space.
-     * 
- * - * uint64 segment_row_count = 9; - * @return The segmentRowCount. - */ - @java.lang.Override - public long getSegmentRowCount() { - return segmentRowCount_; - } - private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -1345,9 +1508,6 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (stats_ != null) { output.writeMessage(8, getStats()); } - if (segmentRowCount_ != 0L) { - output.writeUInt64(9, segmentRowCount_); - } unknownFields.writeTo(output); } @@ -1388,10 +1548,6 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(8, getStats()); } - if (segmentRowCount_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeUInt64Size(9, segmentRowCount_); - } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -1426,8 +1582,6 @@ public boolean equals(final java.lang.Object obj) { if (!getStats() .equals(other.getStats())) return false; } - if (getSegmentRowCount() - != other.getSegmentRowCount()) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -1459,9 +1613,6 @@ public int hashCode() { hash = (37 * hash) + STATS_FIELD_NUMBER; hash = (53 * hash) + getStats().hashCode(); } - hash = (37 * hash) + SEGMENT_ROW_COUNT_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getSegmentRowCount()); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -1619,8 +1770,6 @@ public Builder clear() { stats_ = null; statsBuilder_ = null; } - segmentRowCount_ = 0L; - return this; } @@ -1659,7 +1808,6 @@ public io.greptime.v1.index.Index.InvertedIndexMeta buildPartial() { } else { result.stats_ = statsBuilder_.build(); } - result.segmentRowCount_ = segmentRowCount_; onBuilt(); return result; } @@ -1733,9 +1881,6 @@ public Builder mergeFrom(io.greptime.v1.index.Index.InvertedIndexMeta other) { if (other.hasStats()) { mergeStats(other.getStats()); } - if (other.getSegmentRowCount() != 0L) { - setSegmentRowCount(other.getSegmentRowCount()); - } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -2282,55 +2427,6 @@ public io.greptime.v1.index.Index.InvertedIndexStatsOrBuilder getStatsOrBuilder( } return statsBuilder_; } - - private long segmentRowCount_ ; - /** - *
-       * The number of rows per group for bitmap indexing which determines how rows are
-       * batched for indexing. Each batch corresponds to a segment in the bitmap and allows
-       * for efficient retrieval during queries by reducing the search space.
-       * 
- * - * uint64 segment_row_count = 9; - * @return The segmentRowCount. - */ - @java.lang.Override - public long getSegmentRowCount() { - return segmentRowCount_; - } - /** - *
-       * The number of rows per group for bitmap indexing which determines how rows are
-       * batched for indexing. Each batch corresponds to a segment in the bitmap and allows
-       * for efficient retrieval during queries by reducing the search space.
-       * 
- * - * uint64 segment_row_count = 9; - * @param value The segmentRowCount to set. - * @return This builder for chaining. - */ - public Builder setSegmentRowCount(long value) { - - segmentRowCount_ = value; - onChanged(); - return this; - } - /** - *
-       * The number of rows per group for bitmap indexing which determines how rows are
-       * batched for indexing. Each batch corresponds to a segment in the bitmap and allows
-       * for efficient retrieval during queries by reducing the search space.
-       * 
- * - * uint64 segment_row_count = 9; - * @return This builder for chaining. - */ - public Builder clearSegmentRowCount() { - - segmentRowCount_ = 0L; - onChanged(); - return this; - } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { @@ -3212,23 +3308,24 @@ public io.greptime.v1.index.Index.InvertedIndexStats getDefaultInstanceForType() static { java.lang.String[] descriptorData = { "\n&greptime/v1/index/inverted_index.proto" + - "\022\021greptime.v1.index\"\251\001\n\022InvertedIndexMet" + + "\022\021greptime.v1.index\"\335\001\n\022InvertedIndexMet" + "as\022?\n\005metas\030\001 \003(\01320.greptime.v1.index.In" + - "vertedIndexMetas.MetasEntry\032R\n\nMetasEntr" + - "y\022\013\n\003key\030\001 \001(\t\0223\n\005value\030\002 \001(\0132$.greptime" + - ".v1.index.InvertedIndexMeta:\0028\001\"\222\002\n\021Inve" + - "rtedIndexMeta\022\014\n\004name\030\001 \001(\t\022\023\n\013base_offs" + - "et\030\002 \001(\004\022\033\n\023inverted_index_size\030\003 \001(\004\022\033\n" + - "\023relative_fst_offset\030\004 \001(\r\022\020\n\010fst_size\030\005" + - " \001(\r\022#\n\033relative_null_bitmap_offset\030\006 \001(" + - "\r\022\030\n\020null_bitmap_size\030\007 \001(\r\0224\n\005stats\030\010 \001" + - "(\0132%.greptime.v1.index.InvertedIndexStat" + - "s\022\031\n\021segment_row_count\030\t \001(\004\"f\n\022Inverted" + - "IndexStats\022\022\n\nnull_count\030\001 \001(\004\022\026\n\016distin" + - "ct_count\030\002 \001(\004\022\021\n\tmin_value\030\003 \001(\014\022\021\n\tmax" + - "_value\030\004 \001(\014BZ\n\024io.greptime.v1.indexB\005In" + - "dexZ;github.com/GreptimeTeam/greptime-pr" + - "oto/go/greptime/v1/indexb\006proto3" + "vertedIndexMetas.MetasEntry\022\027\n\017total_row" + + "_count\030\002 \001(\004\022\031\n\021segment_row_count\030\003 \001(\004\032" + + "R\n\nMetasEntry\022\013\n\003key\030\001 \001(\t\0223\n\005value\030\002 \001(" + + "\0132$.greptime.v1.index.InvertedIndexMeta:" + + "\0028\001\"\367\001\n\021InvertedIndexMeta\022\014\n\004name\030\001 \001(\t\022" + + "\023\n\013base_offset\030\002 \001(\004\022\033\n\023inverted_index_s" + + "ize\030\003 \001(\004\022\033\n\023relative_fst_offset\030\004 \001(\r\022\020" + + "\n\010fst_size\030\005 \001(\r\022#\n\033relative_null_bitmap" + + "_offset\030\006 \001(\r\022\030\n\020null_bitmap_size\030\007 \001(\r\022" + + "4\n\005stats\030\010 \001(\0132%.greptime.v1.index.Inver" + + "tedIndexStats\"f\n\022InvertedIndexStats\022\022\n\nn" + + "ull_count\030\001 \001(\004\022\026\n\016distinct_count\030\002 \001(\004\022" + + "\021\n\tmin_value\030\003 \001(\014\022\021\n\tmax_value\030\004 \001(\014BZ\n" + + "\024io.greptime.v1.indexB\005IndexZ;github.com" + + "/GreptimeTeam/greptime-proto/go/greptime" + + "/v1/indexb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -3239,7 +3336,7 @@ public io.greptime.v1.index.Index.InvertedIndexStats getDefaultInstanceForType() internal_static_greptime_v1_index_InvertedIndexMetas_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_greptime_v1_index_InvertedIndexMetas_descriptor, - new java.lang.String[] { "Metas", }); + new java.lang.String[] { "Metas", "TotalRowCount", "SegmentRowCount", }); internal_static_greptime_v1_index_InvertedIndexMetas_MetasEntry_descriptor = internal_static_greptime_v1_index_InvertedIndexMetas_descriptor.getNestedTypes().get(0); internal_static_greptime_v1_index_InvertedIndexMetas_MetasEntry_fieldAccessorTable = new @@ -3251,7 +3348,7 @@ public io.greptime.v1.index.Index.InvertedIndexStats getDefaultInstanceForType() internal_static_greptime_v1_index_InvertedIndexMeta_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_greptime_v1_index_InvertedIndexMeta_descriptor, - new java.lang.String[] { "Name", "BaseOffset", "InvertedIndexSize", "RelativeFstOffset", "FstSize", "RelativeNullBitmapOffset", "NullBitmapSize", "Stats", "SegmentRowCount", }); + new java.lang.String[] { "Name", "BaseOffset", "InvertedIndexSize", "RelativeFstOffset", "FstSize", "RelativeNullBitmapOffset", "NullBitmapSize", "Stats", }); internal_static_greptime_v1_index_InvertedIndexStats_descriptor = getDescriptor().getMessageTypes().get(2); internal_static_greptime_v1_index_InvertedIndexStats_fieldAccessorTable = new diff --git a/proto/greptime/v1/index/inverted_index.proto b/proto/greptime/v1/index/inverted_index.proto index c3c74c24..eae4fc58 100644 --- a/proto/greptime/v1/index/inverted_index.proto +++ b/proto/greptime/v1/index/inverted_index.proto @@ -26,6 +26,15 @@ message InvertedIndexMetas { // A map of tag names to their respective metadata corresponding to an individual // inverted index within the inverted index blob. map metas = 1; + + // The total count of rows within the inverted index blob. + // This is used to determine the number of segments within the bitmap. + uint64 total_row_count = 2; + + // The number of rows per group for bitmap indexing which determines how rows are + // batched for indexing. Each batch corresponds to a segment in the bitmap and allows + // for efficient retrieval during queries by reducing the search space. + uint64 segment_row_count = 3; } // InvertedIndexMeta contains the metadata for a specific tag's inverted index. @@ -56,11 +65,6 @@ message InvertedIndexMeta { // Statistical information about the tag's inverted index. InvertedIndexStats stats = 8; - - // The number of rows per group for bitmap indexing which determines how rows are - // batched for indexing. Each batch corresponds to a segment in the bitmap and allows - // for efficient retrieval during queries by reducing the search space. - uint64 segment_row_count = 9; } // InvertedIndexStats provides statistical data on a tag's inverted index.