From 4a14b140f20d2a8fa2046fbbc5e0947203a3e34c Mon Sep 17 00:00:00 2001 From: discord9 <55937128+discord9@users.noreply.github.com> Date: Wed, 21 Jan 2026 20:10:53 +0800 Subject: [PATCH] feat: pql custom node (#305) * feat: histogram fold&union distinct on Signed-off-by: discord9 * make all Signed-off-by: discord9 * c Signed-off-by: discord9 * make all Signed-off-by: discord9 --------- Signed-off-by: discord9 --- c++/substrait_extension/promql_plan.pb.cc | 568 +++++- c++/substrait_extension/promql_plan.pb.h | 521 ++++++ go/substrait_extension/promql_plan.pb.go | 188 +- .../java/substrait_extension/PromqlPlan.java | 1577 ++++++++++++++++- proto/substrait_extension/promql_plan.proto | 18 + 5 files changed, 2856 insertions(+), 16 deletions(-) diff --git a/c++/substrait_extension/promql_plan.pb.cc b/c++/substrait_extension/promql_plan.pb.cc index b756012..69f1451 100644 --- a/c++/substrait_extension/promql_plan.pb.cc +++ b/c++/substrait_extension/promql_plan.pb.cc @@ -169,8 +169,39 @@ struct LabelPairDefaultTypeInternal { }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 LabelPairDefaultTypeInternal _LabelPair_default_instance_; +PROTOBUF_CONSTEXPR HistogramFold::HistogramFold( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_.le_column_idx_)*/uint64_t{0u} + , /*decltype(_impl_.ts_column_idx_)*/uint64_t{0u} + , /*decltype(_impl_.field_column_idx_)*/uint64_t{0u} + , /*decltype(_impl_.quantile_)*/0 + , /*decltype(_impl_._cached_size_)*/{}} {} +struct HistogramFoldDefaultTypeInternal { + PROTOBUF_CONSTEXPR HistogramFoldDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~HistogramFoldDefaultTypeInternal() {} + union { + HistogramFold _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 HistogramFoldDefaultTypeInternal _HistogramFold_default_instance_; +PROTOBUF_CONSTEXPR UnionDistinctOn::UnionDistinctOn( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_.compare_key_indices_)*/{} + , /*decltype(_impl_._compare_key_indices_cached_byte_size_)*/{0} + , /*decltype(_impl_.ts_col_idx_)*/uint64_t{0u} + , /*decltype(_impl_._cached_size_)*/{}} {} +struct UnionDistinctOnDefaultTypeInternal { + PROTOBUF_CONSTEXPR UnionDistinctOnDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~UnionDistinctOnDefaultTypeInternal() {} + union { + UnionDistinctOn _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 UnionDistinctOnDefaultTypeInternal _UnionDistinctOn_default_instance_; } // namespace substrait_extension -static ::_pb::Metadata file_level_metadata_substrait_5fextension_2fpromql_5fplan_2eproto[8]; +static ::_pb::Metadata file_level_metadata_substrait_5fextension_2fpromql_5fplan_2eproto[10]; static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_substrait_5fextension_2fpromql_5fplan_2eproto = nullptr; static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_substrait_5fextension_2fpromql_5fplan_2eproto = nullptr; @@ -271,6 +302,24 @@ const uint32_t TableStruct_substrait_5fextension_2fpromql_5fplan_2eproto::offset ~0u, // no _inlined_string_donated_ PROTOBUF_FIELD_OFFSET(::substrait_extension::LabelPair, _impl_.key_), PROTOBUF_FIELD_OFFSET(::substrait_extension::LabelPair, _impl_.value_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::substrait_extension::HistogramFold, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::substrait_extension::HistogramFold, _impl_.le_column_idx_), + PROTOBUF_FIELD_OFFSET(::substrait_extension::HistogramFold, _impl_.ts_column_idx_), + PROTOBUF_FIELD_OFFSET(::substrait_extension::HistogramFold, _impl_.field_column_idx_), + PROTOBUF_FIELD_OFFSET(::substrait_extension::HistogramFold, _impl_.quantile_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::substrait_extension::UnionDistinctOn, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::substrait_extension::UnionDistinctOn, _impl_.compare_key_indices_), + PROTOBUF_FIELD_OFFSET(::substrait_extension::UnionDistinctOn, _impl_.ts_col_idx_), }; static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, -1, -1, sizeof(::substrait_extension::EmptyMetric)}, @@ -281,6 +330,8 @@ static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protode { 59, -1, -1, sizeof(::substrait_extension::ScalarCalculate)}, { 74, -1, -1, sizeof(::substrait_extension::Absent)}, { 88, -1, -1, sizeof(::substrait_extension::LabelPair)}, + { 96, -1, -1, sizeof(::substrait_extension::HistogramFold)}, + { 106, -1, -1, sizeof(::substrait_extension::UnionDistinctOn)}, }; static const ::_pb::Message* const file_default_instances[] = { @@ -292,6 +343,8 @@ static const ::_pb::Message* const file_default_instances[] = { &::substrait_extension::_ScalarCalculate_default_instance_._instance, &::substrait_extension::_Absent_default_instance_._instance, &::substrait_extension::_LabelPair_default_instance_._instance, + &::substrait_extension::_HistogramFold_default_instance_._instance, + &::substrait_extension::_UnionDistinctOn_default_instance_._instance, }; const char descriptor_table_protodef_substrait_5fextension_2fpromql_5fplan_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = @@ -326,15 +379,19 @@ const char descriptor_table_protodef_substrait_5fextension_2fpromql_5fplan_2epro "labels\030\006 \003(\0132\036.substrait_extension.Label" "Pair\022\035\n\025time_index_column_idx\030\007 \001(\004\022\030\n\020v" "alue_column_idx\030\010 \001(\004\"\'\n\tLabelPair\022\013\n\003ke" - "y\030\001 \001(\t\022\r\n\005value\030\002 \001(\tB\?Z=github.com/Gre" - "ptimeTeam/greptime-proto/go/substrait_ex" - "tensionb\006proto3" + "y\030\001 \001(\t\022\r\n\005value\030\002 \001(\t\"i\n\rHistogramFold\022" + "\025\n\rle_column_idx\030\001 \001(\004\022\025\n\rts_column_idx\030" + "\002 \001(\004\022\030\n\020field_column_idx\030\003 \001(\004\022\020\n\010quant" + "ile\030\004 \001(\001\"B\n\017UnionDistinctOn\022\033\n\023compare_" + "key_indices\030\001 \003(\004\022\022\n\nts_col_idx\030\002 \001(\004B\?Z" + "=github.com/GreptimeTeam/greptime-proto/" + "go/substrait_extensionb\006proto3" ; static ::_pbi::once_flag descriptor_table_substrait_5fextension_2fpromql_5fplan_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_substrait_5fextension_2fpromql_5fplan_2eproto = { - false, false, 1335, descriptor_table_protodef_substrait_5fextension_2fpromql_5fplan_2eproto, + false, false, 1510, descriptor_table_protodef_substrait_5fextension_2fpromql_5fplan_2eproto, "substrait_extension/promql_plan.proto", - &descriptor_table_substrait_5fextension_2fpromql_5fplan_2eproto_once, nullptr, 0, 8, + &descriptor_table_substrait_5fextension_2fpromql_5fplan_2eproto_once, nullptr, 0, 10, schemas, file_default_instances, TableStruct_substrait_5fextension_2fpromql_5fplan_2eproto::offsets, file_level_metadata_substrait_5fextension_2fpromql_5fplan_2eproto, file_level_enum_descriptors_substrait_5fextension_2fpromql_5fplan_2eproto, file_level_service_descriptors_substrait_5fextension_2fpromql_5fplan_2eproto, @@ -3224,6 +3281,497 @@ void LabelPair::InternalSwap(LabelPair* other) { file_level_metadata_substrait_5fextension_2fpromql_5fplan_2eproto[7]); } +// =================================================================== + +class HistogramFold::_Internal { + public: +}; + +HistogramFold::HistogramFold(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:substrait_extension.HistogramFold) +} +HistogramFold::HistogramFold(const HistogramFold& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + HistogramFold* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_.le_column_idx_){} + , decltype(_impl_.ts_column_idx_){} + , decltype(_impl_.field_column_idx_){} + , decltype(_impl_.quantile_){} + , /*decltype(_impl_._cached_size_)*/{}}; + + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + ::memcpy(&_impl_.le_column_idx_, &from._impl_.le_column_idx_, + static_cast(reinterpret_cast(&_impl_.quantile_) - + reinterpret_cast(&_impl_.le_column_idx_)) + sizeof(_impl_.quantile_)); + // @@protoc_insertion_point(copy_constructor:substrait_extension.HistogramFold) +} + +inline void HistogramFold::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_.le_column_idx_){uint64_t{0u}} + , decltype(_impl_.ts_column_idx_){uint64_t{0u}} + , decltype(_impl_.field_column_idx_){uint64_t{0u}} + , decltype(_impl_.quantile_){0} + , /*decltype(_impl_._cached_size_)*/{} + }; +} + +HistogramFold::~HistogramFold() { + // @@protoc_insertion_point(destructor:substrait_extension.HistogramFold) + if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void HistogramFold::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void HistogramFold::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void HistogramFold::Clear() { +// @@protoc_insertion_point(message_clear_start:substrait_extension.HistogramFold) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + ::memset(&_impl_.le_column_idx_, 0, static_cast( + reinterpret_cast(&_impl_.quantile_) - + reinterpret_cast(&_impl_.le_column_idx_)) + sizeof(_impl_.quantile_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* HistogramFold::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // uint64 le_column_idx = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _impl_.le_column_idx_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint64 ts_column_idx = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _impl_.ts_column_idx_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint64 field_column_idx = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _impl_.field_column_idx_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // double quantile = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 33)) { + _impl_.quantile_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad(ptr); + ptr += sizeof(double); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* HistogramFold::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:substrait_extension.HistogramFold) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // uint64 le_column_idx = 1; + if (this->_internal_le_column_idx() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt64ToArray(1, this->_internal_le_column_idx(), target); + } + + // uint64 ts_column_idx = 2; + if (this->_internal_ts_column_idx() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt64ToArray(2, this->_internal_ts_column_idx(), target); + } + + // uint64 field_column_idx = 3; + if (this->_internal_field_column_idx() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt64ToArray(3, this->_internal_field_column_idx(), target); + } + + // double quantile = 4; + static_assert(sizeof(uint64_t) == sizeof(double), "Code assumes uint64_t and double are the same size."); + double tmp_quantile = this->_internal_quantile(); + uint64_t raw_quantile; + memcpy(&raw_quantile, &tmp_quantile, sizeof(tmp_quantile)); + if (raw_quantile != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteDoubleToArray(4, this->_internal_quantile(), 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); + } + // @@protoc_insertion_point(serialize_to_array_end:substrait_extension.HistogramFold) + return target; +} + +size_t HistogramFold::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:substrait_extension.HistogramFold) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // uint64 le_column_idx = 1; + if (this->_internal_le_column_idx() != 0) { + total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_le_column_idx()); + } + + // uint64 ts_column_idx = 2; + if (this->_internal_ts_column_idx() != 0) { + total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_ts_column_idx()); + } + + // uint64 field_column_idx = 3; + if (this->_internal_field_column_idx() != 0) { + total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_field_column_idx()); + } + + // double quantile = 4; + static_assert(sizeof(uint64_t) == sizeof(double), "Code assumes uint64_t and double are the same size."); + double tmp_quantile = this->_internal_quantile(); + uint64_t raw_quantile; + memcpy(&raw_quantile, &tmp_quantile, sizeof(tmp_quantile)); + if (raw_quantile != 0) { + total_size += 1 + 8; + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData HistogramFold::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, + HistogramFold::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*HistogramFold::GetClassData() const { return &_class_data_; } + + +void HistogramFold::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:substrait_extension.HistogramFold) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_le_column_idx() != 0) { + _this->_internal_set_le_column_idx(from._internal_le_column_idx()); + } + if (from._internal_ts_column_idx() != 0) { + _this->_internal_set_ts_column_idx(from._internal_ts_column_idx()); + } + if (from._internal_field_column_idx() != 0) { + _this->_internal_set_field_column_idx(from._internal_field_column_idx()); + } + static_assert(sizeof(uint64_t) == sizeof(double), "Code assumes uint64_t and double are the same size."); + double tmp_quantile = from._internal_quantile(); + uint64_t raw_quantile; + memcpy(&raw_quantile, &tmp_quantile, sizeof(tmp_quantile)); + if (raw_quantile != 0) { + _this->_internal_set_quantile(from._internal_quantile()); + } + _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void HistogramFold::CopyFrom(const HistogramFold& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:substrait_extension.HistogramFold) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool HistogramFold::IsInitialized() const { + return true; +} + +void HistogramFold::InternalSwap(HistogramFold* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(HistogramFold, _impl_.quantile_) + + sizeof(HistogramFold::_impl_.quantile_) + - PROTOBUF_FIELD_OFFSET(HistogramFold, _impl_.le_column_idx_)>( + reinterpret_cast(&_impl_.le_column_idx_), + reinterpret_cast(&other->_impl_.le_column_idx_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata HistogramFold::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_substrait_5fextension_2fpromql_5fplan_2eproto_getter, &descriptor_table_substrait_5fextension_2fpromql_5fplan_2eproto_once, + file_level_metadata_substrait_5fextension_2fpromql_5fplan_2eproto[8]); +} + +// =================================================================== + +class UnionDistinctOn::_Internal { + public: +}; + +UnionDistinctOn::UnionDistinctOn(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:substrait_extension.UnionDistinctOn) +} +UnionDistinctOn::UnionDistinctOn(const UnionDistinctOn& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + UnionDistinctOn* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_.compare_key_indices_){from._impl_.compare_key_indices_} + , /*decltype(_impl_._compare_key_indices_cached_byte_size_)*/{0} + , decltype(_impl_.ts_col_idx_){} + , /*decltype(_impl_._cached_size_)*/{}}; + + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + _this->_impl_.ts_col_idx_ = from._impl_.ts_col_idx_; + // @@protoc_insertion_point(copy_constructor:substrait_extension.UnionDistinctOn) +} + +inline void UnionDistinctOn::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_.compare_key_indices_){arena} + , /*decltype(_impl_._compare_key_indices_cached_byte_size_)*/{0} + , decltype(_impl_.ts_col_idx_){uint64_t{0u}} + , /*decltype(_impl_._cached_size_)*/{} + }; +} + +UnionDistinctOn::~UnionDistinctOn() { + // @@protoc_insertion_point(destructor:substrait_extension.UnionDistinctOn) + if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void UnionDistinctOn::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.compare_key_indices_.~RepeatedField(); +} + +void UnionDistinctOn::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void UnionDistinctOn::Clear() { +// @@protoc_insertion_point(message_clear_start:substrait_extension.UnionDistinctOn) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.compare_key_indices_.Clear(); + _impl_.ts_col_idx_ = uint64_t{0u}; + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* UnionDistinctOn::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // repeated uint64 compare_key_indices = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedUInt64Parser(_internal_mutable_compare_key_indices(), ptr, ctx); + CHK_(ptr); + } else if (static_cast(tag) == 8) { + _internal_add_compare_key_indices(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr)); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint64 ts_col_idx = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _impl_.ts_col_idx_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* UnionDistinctOn::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:substrait_extension.UnionDistinctOn) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // repeated uint64 compare_key_indices = 1; + { + int byte_size = _impl_._compare_key_indices_cached_byte_size_.load(std::memory_order_relaxed); + if (byte_size > 0) { + target = stream->WriteUInt64Packed( + 1, _internal_compare_key_indices(), byte_size, target); + } + } + + // uint64 ts_col_idx = 2; + if (this->_internal_ts_col_idx() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt64ToArray(2, this->_internal_ts_col_idx(), 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); + } + // @@protoc_insertion_point(serialize_to_array_end:substrait_extension.UnionDistinctOn) + return target; +} + +size_t UnionDistinctOn::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:substrait_extension.UnionDistinctOn) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated uint64 compare_key_indices = 1; + { + size_t data_size = ::_pbi::WireFormatLite:: + UInt64Size(this->_impl_.compare_key_indices_); + if (data_size > 0) { + total_size += 1 + + ::_pbi::WireFormatLite::Int32Size(static_cast(data_size)); + } + int cached_size = ::_pbi::ToCachedSize(data_size); + _impl_._compare_key_indices_cached_byte_size_.store(cached_size, + std::memory_order_relaxed); + total_size += data_size; + } + + // uint64 ts_col_idx = 2; + if (this->_internal_ts_col_idx() != 0) { + total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_ts_col_idx()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData UnionDistinctOn::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, + UnionDistinctOn::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*UnionDistinctOn::GetClassData() const { return &_class_data_; } + + +void UnionDistinctOn::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:substrait_extension.UnionDistinctOn) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _this->_impl_.compare_key_indices_.MergeFrom(from._impl_.compare_key_indices_); + if (from._internal_ts_col_idx() != 0) { + _this->_internal_set_ts_col_idx(from._internal_ts_col_idx()); + } + _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void UnionDistinctOn::CopyFrom(const UnionDistinctOn& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:substrait_extension.UnionDistinctOn) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool UnionDistinctOn::IsInitialized() const { + return true; +} + +void UnionDistinctOn::InternalSwap(UnionDistinctOn* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + _impl_.compare_key_indices_.InternalSwap(&other->_impl_.compare_key_indices_); + swap(_impl_.ts_col_idx_, other->_impl_.ts_col_idx_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata UnionDistinctOn::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_substrait_5fextension_2fpromql_5fplan_2eproto_getter, &descriptor_table_substrait_5fextension_2fpromql_5fplan_2eproto_once, + file_level_metadata_substrait_5fextension_2fpromql_5fplan_2eproto[9]); +} + // @@protoc_insertion_point(namespace_scope) } // namespace substrait_extension PROTOBUF_NAMESPACE_OPEN @@ -3259,6 +3807,14 @@ template<> PROTOBUF_NOINLINE ::substrait_extension::LabelPair* Arena::CreateMaybeMessage< ::substrait_extension::LabelPair >(Arena* arena) { return Arena::CreateMessageInternal< ::substrait_extension::LabelPair >(arena); } +template<> PROTOBUF_NOINLINE ::substrait_extension::HistogramFold* +Arena::CreateMaybeMessage< ::substrait_extension::HistogramFold >(Arena* arena) { + return Arena::CreateMessageInternal< ::substrait_extension::HistogramFold >(arena); +} +template<> PROTOBUF_NOINLINE ::substrait_extension::UnionDistinctOn* +Arena::CreateMaybeMessage< ::substrait_extension::UnionDistinctOn >(Arena* arena) { + return Arena::CreateMessageInternal< ::substrait_extension::UnionDistinctOn >(arena); +} PROTOBUF_NAMESPACE_CLOSE // @@protoc_insertion_point(global_scope) diff --git a/c++/substrait_extension/promql_plan.pb.h b/c++/substrait_extension/promql_plan.pb.h index 969f008..9d6ded2 100644 --- a/c++/substrait_extension/promql_plan.pb.h +++ b/c++/substrait_extension/promql_plan.pb.h @@ -51,6 +51,9 @@ extern AbsentDefaultTypeInternal _Absent_default_instance_; class EmptyMetric; struct EmptyMetricDefaultTypeInternal; extern EmptyMetricDefaultTypeInternal _EmptyMetric_default_instance_; +class HistogramFold; +struct HistogramFoldDefaultTypeInternal; +extern HistogramFoldDefaultTypeInternal _HistogramFold_default_instance_; class InstantManipulate; struct InstantManipulateDefaultTypeInternal; extern InstantManipulateDefaultTypeInternal _InstantManipulate_default_instance_; @@ -69,16 +72,21 @@ extern SeriesDivideDefaultTypeInternal _SeriesDivide_default_instance_; class SeriesNormalize; struct SeriesNormalizeDefaultTypeInternal; extern SeriesNormalizeDefaultTypeInternal _SeriesNormalize_default_instance_; +class UnionDistinctOn; +struct UnionDistinctOnDefaultTypeInternal; +extern UnionDistinctOnDefaultTypeInternal _UnionDistinctOn_default_instance_; } // namespace substrait_extension PROTOBUF_NAMESPACE_OPEN template<> ::substrait_extension::Absent* Arena::CreateMaybeMessage<::substrait_extension::Absent>(Arena*); template<> ::substrait_extension::EmptyMetric* Arena::CreateMaybeMessage<::substrait_extension::EmptyMetric>(Arena*); +template<> ::substrait_extension::HistogramFold* Arena::CreateMaybeMessage<::substrait_extension::HistogramFold>(Arena*); template<> ::substrait_extension::InstantManipulate* Arena::CreateMaybeMessage<::substrait_extension::InstantManipulate>(Arena*); template<> ::substrait_extension::LabelPair* Arena::CreateMaybeMessage<::substrait_extension::LabelPair>(Arena*); template<> ::substrait_extension::RangeManipulate* Arena::CreateMaybeMessage<::substrait_extension::RangeManipulate>(Arena*); template<> ::substrait_extension::ScalarCalculate* Arena::CreateMaybeMessage<::substrait_extension::ScalarCalculate>(Arena*); template<> ::substrait_extension::SeriesDivide* Arena::CreateMaybeMessage<::substrait_extension::SeriesDivide>(Arena*); template<> ::substrait_extension::SeriesNormalize* Arena::CreateMaybeMessage<::substrait_extension::SeriesNormalize>(Arena*); +template<> ::substrait_extension::UnionDistinctOn* Arena::CreateMaybeMessage<::substrait_extension::UnionDistinctOn>(Arena*); PROTOBUF_NAMESPACE_CLOSE namespace substrait_extension { @@ -1886,6 +1894,360 @@ class LabelPair final : union { Impl_ _impl_; }; friend struct ::TableStruct_substrait_5fextension_2fpromql_5fplan_2eproto; }; +// ------------------------------------------------------------------- + +class HistogramFold final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:substrait_extension.HistogramFold) */ { + public: + inline HistogramFold() : HistogramFold(nullptr) {} + ~HistogramFold() override; + explicit PROTOBUF_CONSTEXPR HistogramFold(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + HistogramFold(const HistogramFold& from); + HistogramFold(HistogramFold&& from) noexcept + : HistogramFold() { + *this = ::std::move(from); + } + + inline HistogramFold& operator=(const HistogramFold& from) { + CopyFrom(from); + return *this; + } + inline HistogramFold& operator=(HistogramFold&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const HistogramFold& default_instance() { + return *internal_default_instance(); + } + static inline const HistogramFold* internal_default_instance() { + return reinterpret_cast( + &_HistogramFold_default_instance_); + } + static constexpr int kIndexInFileMessages = + 8; + + friend void swap(HistogramFold& a, HistogramFold& b) { + a.Swap(&b); + } + inline void Swap(HistogramFold* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(HistogramFold* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + HistogramFold* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const HistogramFold& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const HistogramFold& from) { + HistogramFold::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(HistogramFold* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "substrait_extension.HistogramFold"; + } + protected: + explicit HistogramFold(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kLeColumnIdxFieldNumber = 1, + kTsColumnIdxFieldNumber = 2, + kFieldColumnIdxFieldNumber = 3, + kQuantileFieldNumber = 4, + }; + // uint64 le_column_idx = 1; + void clear_le_column_idx(); + uint64_t le_column_idx() const; + void set_le_column_idx(uint64_t value); + private: + uint64_t _internal_le_column_idx() const; + void _internal_set_le_column_idx(uint64_t value); + public: + + // uint64 ts_column_idx = 2; + void clear_ts_column_idx(); + uint64_t ts_column_idx() const; + void set_ts_column_idx(uint64_t value); + private: + uint64_t _internal_ts_column_idx() const; + void _internal_set_ts_column_idx(uint64_t value); + public: + + // uint64 field_column_idx = 3; + void clear_field_column_idx(); + uint64_t field_column_idx() const; + void set_field_column_idx(uint64_t value); + private: + uint64_t _internal_field_column_idx() const; + void _internal_set_field_column_idx(uint64_t value); + public: + + // double quantile = 4; + void clear_quantile(); + double quantile() const; + void set_quantile(double value); + private: + double _internal_quantile() const; + void _internal_set_quantile(double value); + public: + + // @@protoc_insertion_point(class_scope:substrait_extension.HistogramFold) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + uint64_t le_column_idx_; + uint64_t ts_column_idx_; + uint64_t field_column_idx_; + double quantile_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_substrait_5fextension_2fpromql_5fplan_2eproto; +}; +// ------------------------------------------------------------------- + +class UnionDistinctOn final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:substrait_extension.UnionDistinctOn) */ { + public: + inline UnionDistinctOn() : UnionDistinctOn(nullptr) {} + ~UnionDistinctOn() override; + explicit PROTOBUF_CONSTEXPR UnionDistinctOn(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + UnionDistinctOn(const UnionDistinctOn& from); + UnionDistinctOn(UnionDistinctOn&& from) noexcept + : UnionDistinctOn() { + *this = ::std::move(from); + } + + inline UnionDistinctOn& operator=(const UnionDistinctOn& from) { + CopyFrom(from); + return *this; + } + inline UnionDistinctOn& operator=(UnionDistinctOn&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const UnionDistinctOn& default_instance() { + return *internal_default_instance(); + } + static inline const UnionDistinctOn* internal_default_instance() { + return reinterpret_cast( + &_UnionDistinctOn_default_instance_); + } + static constexpr int kIndexInFileMessages = + 9; + + friend void swap(UnionDistinctOn& a, UnionDistinctOn& b) { + a.Swap(&b); + } + inline void Swap(UnionDistinctOn* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(UnionDistinctOn* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + UnionDistinctOn* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const UnionDistinctOn& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const UnionDistinctOn& from) { + UnionDistinctOn::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(UnionDistinctOn* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "substrait_extension.UnionDistinctOn"; + } + protected: + explicit UnionDistinctOn(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kCompareKeyIndicesFieldNumber = 1, + kTsColIdxFieldNumber = 2, + }; + // repeated uint64 compare_key_indices = 1; + int compare_key_indices_size() const; + private: + int _internal_compare_key_indices_size() const; + public: + void clear_compare_key_indices(); + private: + uint64_t _internal_compare_key_indices(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >& + _internal_compare_key_indices() const; + void _internal_add_compare_key_indices(uint64_t value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >* + _internal_mutable_compare_key_indices(); + public: + uint64_t compare_key_indices(int index) const; + void set_compare_key_indices(int index, uint64_t value); + void add_compare_key_indices(uint64_t value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >& + compare_key_indices() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >* + mutable_compare_key_indices(); + + // uint64 ts_col_idx = 2; + void clear_ts_col_idx(); + uint64_t ts_col_idx() const; + void set_ts_col_idx(uint64_t value); + private: + uint64_t _internal_ts_col_idx() const; + void _internal_set_ts_col_idx(uint64_t value); + public: + + // @@protoc_insertion_point(class_scope:substrait_extension.UnionDistinctOn) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t > compare_key_indices_; + mutable std::atomic _compare_key_indices_cached_byte_size_; + uint64_t ts_col_idx_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_substrait_5fextension_2fpromql_5fplan_2eproto; +}; // =================================================================== @@ -3563,6 +3925,161 @@ inline void LabelPair::set_allocated_value(std::string* value) { // @@protoc_insertion_point(field_set_allocated:substrait_extension.LabelPair.value) } +// ------------------------------------------------------------------- + +// HistogramFold + +// uint64 le_column_idx = 1; +inline void HistogramFold::clear_le_column_idx() { + _impl_.le_column_idx_ = uint64_t{0u}; +} +inline uint64_t HistogramFold::_internal_le_column_idx() const { + return _impl_.le_column_idx_; +} +inline uint64_t HistogramFold::le_column_idx() const { + // @@protoc_insertion_point(field_get:substrait_extension.HistogramFold.le_column_idx) + return _internal_le_column_idx(); +} +inline void HistogramFold::_internal_set_le_column_idx(uint64_t value) { + + _impl_.le_column_idx_ = value; +} +inline void HistogramFold::set_le_column_idx(uint64_t value) { + _internal_set_le_column_idx(value); + // @@protoc_insertion_point(field_set:substrait_extension.HistogramFold.le_column_idx) +} + +// uint64 ts_column_idx = 2; +inline void HistogramFold::clear_ts_column_idx() { + _impl_.ts_column_idx_ = uint64_t{0u}; +} +inline uint64_t HistogramFold::_internal_ts_column_idx() const { + return _impl_.ts_column_idx_; +} +inline uint64_t HistogramFold::ts_column_idx() const { + // @@protoc_insertion_point(field_get:substrait_extension.HistogramFold.ts_column_idx) + return _internal_ts_column_idx(); +} +inline void HistogramFold::_internal_set_ts_column_idx(uint64_t value) { + + _impl_.ts_column_idx_ = value; +} +inline void HistogramFold::set_ts_column_idx(uint64_t value) { + _internal_set_ts_column_idx(value); + // @@protoc_insertion_point(field_set:substrait_extension.HistogramFold.ts_column_idx) +} + +// uint64 field_column_idx = 3; +inline void HistogramFold::clear_field_column_idx() { + _impl_.field_column_idx_ = uint64_t{0u}; +} +inline uint64_t HistogramFold::_internal_field_column_idx() const { + return _impl_.field_column_idx_; +} +inline uint64_t HistogramFold::field_column_idx() const { + // @@protoc_insertion_point(field_get:substrait_extension.HistogramFold.field_column_idx) + return _internal_field_column_idx(); +} +inline void HistogramFold::_internal_set_field_column_idx(uint64_t value) { + + _impl_.field_column_idx_ = value; +} +inline void HistogramFold::set_field_column_idx(uint64_t value) { + _internal_set_field_column_idx(value); + // @@protoc_insertion_point(field_set:substrait_extension.HistogramFold.field_column_idx) +} + +// double quantile = 4; +inline void HistogramFold::clear_quantile() { + _impl_.quantile_ = 0; +} +inline double HistogramFold::_internal_quantile() const { + return _impl_.quantile_; +} +inline double HistogramFold::quantile() const { + // @@protoc_insertion_point(field_get:substrait_extension.HistogramFold.quantile) + return _internal_quantile(); +} +inline void HistogramFold::_internal_set_quantile(double value) { + + _impl_.quantile_ = value; +} +inline void HistogramFold::set_quantile(double value) { + _internal_set_quantile(value); + // @@protoc_insertion_point(field_set:substrait_extension.HistogramFold.quantile) +} + +// ------------------------------------------------------------------- + +// UnionDistinctOn + +// repeated uint64 compare_key_indices = 1; +inline int UnionDistinctOn::_internal_compare_key_indices_size() const { + return _impl_.compare_key_indices_.size(); +} +inline int UnionDistinctOn::compare_key_indices_size() const { + return _internal_compare_key_indices_size(); +} +inline void UnionDistinctOn::clear_compare_key_indices() { + _impl_.compare_key_indices_.Clear(); +} +inline uint64_t UnionDistinctOn::_internal_compare_key_indices(int index) const { + return _impl_.compare_key_indices_.Get(index); +} +inline uint64_t UnionDistinctOn::compare_key_indices(int index) const { + // @@protoc_insertion_point(field_get:substrait_extension.UnionDistinctOn.compare_key_indices) + return _internal_compare_key_indices(index); +} +inline void UnionDistinctOn::set_compare_key_indices(int index, uint64_t value) { + _impl_.compare_key_indices_.Set(index, value); + // @@protoc_insertion_point(field_set:substrait_extension.UnionDistinctOn.compare_key_indices) +} +inline void UnionDistinctOn::_internal_add_compare_key_indices(uint64_t value) { + _impl_.compare_key_indices_.Add(value); +} +inline void UnionDistinctOn::add_compare_key_indices(uint64_t value) { + _internal_add_compare_key_indices(value); + // @@protoc_insertion_point(field_add:substrait_extension.UnionDistinctOn.compare_key_indices) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >& +UnionDistinctOn::_internal_compare_key_indices() const { + return _impl_.compare_key_indices_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >& +UnionDistinctOn::compare_key_indices() const { + // @@protoc_insertion_point(field_list:substrait_extension.UnionDistinctOn.compare_key_indices) + return _internal_compare_key_indices(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >* +UnionDistinctOn::_internal_mutable_compare_key_indices() { + return &_impl_.compare_key_indices_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint64_t >* +UnionDistinctOn::mutable_compare_key_indices() { + // @@protoc_insertion_point(field_mutable_list:substrait_extension.UnionDistinctOn.compare_key_indices) + return _internal_mutable_compare_key_indices(); +} + +// uint64 ts_col_idx = 2; +inline void UnionDistinctOn::clear_ts_col_idx() { + _impl_.ts_col_idx_ = uint64_t{0u}; +} +inline uint64_t UnionDistinctOn::_internal_ts_col_idx() const { + return _impl_.ts_col_idx_; +} +inline uint64_t UnionDistinctOn::ts_col_idx() const { + // @@protoc_insertion_point(field_get:substrait_extension.UnionDistinctOn.ts_col_idx) + return _internal_ts_col_idx(); +} +inline void UnionDistinctOn::_internal_set_ts_col_idx(uint64_t value) { + + _impl_.ts_col_idx_ = value; +} +inline void UnionDistinctOn::set_ts_col_idx(uint64_t value) { + _internal_set_ts_col_idx(value); + // @@protoc_insertion_point(field_set:substrait_extension.UnionDistinctOn.ts_col_idx) +} + #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ @@ -3580,6 +4097,10 @@ inline void LabelPair::set_allocated_value(std::string* value) { // ------------------------------------------------------------------- +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + // @@protoc_insertion_point(namespace_scope) diff --git a/go/substrait_extension/promql_plan.pb.go b/go/substrait_extension/promql_plan.pb.go index bff162b..e3407f4 100644 --- a/go/substrait_extension/promql_plan.pb.go +++ b/go/substrait_extension/promql_plan.pb.go @@ -828,6 +828,138 @@ func (x *LabelPair) GetValue() string { return "" } +type HistogramFold struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Column index of the `le` column (histogram bucket bounds) + LeColumnIdx uint64 `protobuf:"varint,1,opt,name=le_column_idx,json=leColumnIdx,proto3" json:"le_column_idx,omitempty"` + // Column index of the timestamp column + TsColumnIdx uint64 `protobuf:"varint,2,opt,name=ts_column_idx,json=tsColumnIdx,proto3" json:"ts_column_idx,omitempty"` + // Column index of the field column (histogram values) + FieldColumnIdx uint64 `protobuf:"varint,3,opt,name=field_column_idx,json=fieldColumnIdx,proto3" json:"field_column_idx,omitempty"` + // Quantile value + Quantile float64 `protobuf:"fixed64,4,opt,name=quantile,proto3" json:"quantile,omitempty"` +} + +func (x *HistogramFold) Reset() { + *x = HistogramFold{} + if protoimpl.UnsafeEnabled { + mi := &file_substrait_extension_promql_plan_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HistogramFold) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HistogramFold) ProtoMessage() {} + +func (x *HistogramFold) ProtoReflect() protoreflect.Message { + mi := &file_substrait_extension_promql_plan_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HistogramFold.ProtoReflect.Descriptor instead. +func (*HistogramFold) Descriptor() ([]byte, []int) { + return file_substrait_extension_promql_plan_proto_rawDescGZIP(), []int{8} +} + +func (x *HistogramFold) GetLeColumnIdx() uint64 { + if x != nil { + return x.LeColumnIdx + } + return 0 +} + +func (x *HistogramFold) GetTsColumnIdx() uint64 { + if x != nil { + return x.TsColumnIdx + } + return 0 +} + +func (x *HistogramFold) GetFieldColumnIdx() uint64 { + if x != nil { + return x.FieldColumnIdx + } + return 0 +} + +func (x *HistogramFold) GetQuantile() float64 { + if x != nil { + return x.Quantile + } + return 0 +} + +type UnionDistinctOn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Indices of columns to compare for equality + CompareKeyIndices []uint64 `protobuf:"varint,1,rep,packed,name=compare_key_indices,json=compareKeyIndices,proto3" json:"compare_key_indices,omitempty"` + // Column index of the timestamp column + TsColIdx uint64 `protobuf:"varint,2,opt,name=ts_col_idx,json=tsColIdx,proto3" json:"ts_col_idx,omitempty"` +} + +func (x *UnionDistinctOn) Reset() { + *x = UnionDistinctOn{} + if protoimpl.UnsafeEnabled { + mi := &file_substrait_extension_promql_plan_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UnionDistinctOn) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnionDistinctOn) ProtoMessage() {} + +func (x *UnionDistinctOn) ProtoReflect() protoreflect.Message { + mi := &file_substrait_extension_promql_plan_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnionDistinctOn.ProtoReflect.Descriptor instead. +func (*UnionDistinctOn) Descriptor() ([]byte, []int) { + return file_substrait_extension_promql_plan_proto_rawDescGZIP(), []int{9} +} + +func (x *UnionDistinctOn) GetCompareKeyIndices() []uint64 { + if x != nil { + return x.CompareKeyIndices + } + return nil +} + +func (x *UnionDistinctOn) GetTsColIdx() uint64 { + if x != nil { + return x.TsColIdx + } + return 0 +} + var File_substrait_extension_promql_plan_proto protoreflect.FileDescriptor var file_substrait_extension_promql_plan_proto_rawDesc = []byte{ @@ -944,11 +1076,27 @@ var file_substrait_extension_promql_plan_proto_rawDesc = []byte{ 0x33, 0x0a, 0x09, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x50, 0x61, 0x69, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x42, 0x3f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x2f, - 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, - 0x6f, 0x2f, 0x73, 0x75, 0x62, 0x73, 0x74, 0x72, 0x61, 0x69, 0x74, 0x5f, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9d, 0x01, 0x0a, 0x0d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, + 0x61, 0x6d, 0x46, 0x6f, 0x6c, 0x64, 0x12, 0x22, 0x0a, 0x0d, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x6c, + 0x75, 0x6d, 0x6e, 0x5f, 0x69, 0x64, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6c, + 0x65, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x49, 0x64, 0x78, 0x12, 0x22, 0x0a, 0x0d, 0x74, 0x73, + 0x5f, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x69, 0x64, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x0b, 0x74, 0x73, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x49, 0x64, 0x78, 0x12, 0x28, + 0x0a, 0x10, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x69, + 0x64, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x43, + 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x49, 0x64, 0x78, 0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, + 0x74, 0x69, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, + 0x74, 0x69, 0x6c, 0x65, 0x22, 0x5f, 0x0a, 0x0f, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x44, 0x69, 0x73, + 0x74, 0x69, 0x6e, 0x63, 0x74, 0x4f, 0x6e, 0x12, 0x2e, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x70, 0x61, + 0x72, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x04, 0x52, 0x11, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x72, 0x65, 0x4b, 0x65, 0x79, + 0x49, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x0a, 0x74, 0x73, 0x5f, 0x63, 0x6f, + 0x6c, 0x5f, 0x69, 0x64, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x74, 0x73, 0x43, + 0x6f, 0x6c, 0x49, 0x64, 0x78, 0x42, 0x3f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x54, 0x65, 0x61, 0x6d, + 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x67, 0x6f, 0x2f, 0x73, 0x75, 0x62, 0x73, 0x74, 0x72, 0x61, 0x69, 0x74, 0x5f, 0x65, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -963,7 +1111,7 @@ func file_substrait_extension_promql_plan_proto_rawDescGZIP() []byte { return file_substrait_extension_promql_plan_proto_rawDescData } -var file_substrait_extension_promql_plan_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_substrait_extension_promql_plan_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_substrait_extension_promql_plan_proto_goTypes = []interface{}{ (*EmptyMetric)(nil), // 0: substrait_extension.EmptyMetric (*InstantManipulate)(nil), // 1: substrait_extension.InstantManipulate @@ -973,6 +1121,8 @@ var file_substrait_extension_promql_plan_proto_goTypes = []interface{}{ (*ScalarCalculate)(nil), // 5: substrait_extension.ScalarCalculate (*Absent)(nil), // 6: substrait_extension.Absent (*LabelPair)(nil), // 7: substrait_extension.LabelPair + (*HistogramFold)(nil), // 8: substrait_extension.HistogramFold + (*UnionDistinctOn)(nil), // 9: substrait_extension.UnionDistinctOn } var file_substrait_extension_promql_plan_proto_depIdxs = []int32{ 7, // 0: substrait_extension.Absent.fake_labels:type_name -> substrait_extension.LabelPair @@ -1085,6 +1235,30 @@ func file_substrait_extension_promql_plan_proto_init() { return nil } } + file_substrait_extension_promql_plan_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HistogramFold); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_substrait_extension_promql_plan_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UnionDistinctOn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -1092,7 +1266,7 @@ func file_substrait_extension_promql_plan_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_substrait_extension_promql_plan_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 10, NumExtensions: 0, NumServices: 0, }, diff --git a/java/src/main/java/substrait_extension/PromqlPlan.java b/java/src/main/java/substrait_extension/PromqlPlan.java index 611065b..24f721f 100644 --- a/java/src/main/java/substrait_extension/PromqlPlan.java +++ b/java/src/main/java/substrait_extension/PromqlPlan.java @@ -10966,6 +10966,1551 @@ public final class PromqlPlan { } + public interface HistogramFoldOrBuilder extends + // @@protoc_insertion_point(interface_extends:substrait_extension.HistogramFold) + com.google.protobuf.MessageOrBuilder { + + /** + *
+     * Column index of the `le` column (histogram bucket bounds)
+     * 
+ * + * uint64 le_column_idx = 1; + * @return The leColumnIdx. + */ + long getLeColumnIdx(); + + /** + *
+     * Column index of the timestamp column
+     * 
+ * + * uint64 ts_column_idx = 2; + * @return The tsColumnIdx. + */ + long getTsColumnIdx(); + + /** + *
+     * Column index of the field column (histogram values)
+     * 
+ * + * uint64 field_column_idx = 3; + * @return The fieldColumnIdx. + */ + long getFieldColumnIdx(); + + /** + *
+     * Quantile value
+     * 
+ * + * double quantile = 4; + * @return The quantile. + */ + double getQuantile(); + } + /** + * Protobuf type {@code substrait_extension.HistogramFold} + */ + public static final class HistogramFold extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:substrait_extension.HistogramFold) + HistogramFoldOrBuilder { + private static final long serialVersionUID = 0L; + // Use HistogramFold.newBuilder() to construct. + private HistogramFold(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private HistogramFold() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new HistogramFold(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private HistogramFold( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + leColumnIdx_ = input.readUInt64(); + break; + } + case 16: { + + tsColumnIdx_ = input.readUInt64(); + break; + } + case 24: { + + fieldColumnIdx_ = input.readUInt64(); + break; + } + case 33: { + + quantile_ = input.readDouble(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return substrait_extension.PromqlPlan.internal_static_substrait_extension_HistogramFold_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return substrait_extension.PromqlPlan.internal_static_substrait_extension_HistogramFold_fieldAccessorTable + .ensureFieldAccessorsInitialized( + substrait_extension.PromqlPlan.HistogramFold.class, substrait_extension.PromqlPlan.HistogramFold.Builder.class); + } + + public static final int LE_COLUMN_IDX_FIELD_NUMBER = 1; + private long leColumnIdx_; + /** + *
+     * Column index of the `le` column (histogram bucket bounds)
+     * 
+ * + * uint64 le_column_idx = 1; + * @return The leColumnIdx. + */ + @java.lang.Override + public long getLeColumnIdx() { + return leColumnIdx_; + } + + public static final int TS_COLUMN_IDX_FIELD_NUMBER = 2; + private long tsColumnIdx_; + /** + *
+     * Column index of the timestamp column
+     * 
+ * + * uint64 ts_column_idx = 2; + * @return The tsColumnIdx. + */ + @java.lang.Override + public long getTsColumnIdx() { + return tsColumnIdx_; + } + + public static final int FIELD_COLUMN_IDX_FIELD_NUMBER = 3; + private long fieldColumnIdx_; + /** + *
+     * Column index of the field column (histogram values)
+     * 
+ * + * uint64 field_column_idx = 3; + * @return The fieldColumnIdx. + */ + @java.lang.Override + public long getFieldColumnIdx() { + return fieldColumnIdx_; + } + + public static final int QUANTILE_FIELD_NUMBER = 4; + private double quantile_; + /** + *
+     * Quantile value
+     * 
+ * + * double quantile = 4; + * @return The quantile. + */ + @java.lang.Override + public double getQuantile() { + return quantile_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (leColumnIdx_ != 0L) { + output.writeUInt64(1, leColumnIdx_); + } + if (tsColumnIdx_ != 0L) { + output.writeUInt64(2, tsColumnIdx_); + } + if (fieldColumnIdx_ != 0L) { + output.writeUInt64(3, fieldColumnIdx_); + } + if (java.lang.Double.doubleToRawLongBits(quantile_) != 0) { + output.writeDouble(4, quantile_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (leColumnIdx_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(1, leColumnIdx_); + } + if (tsColumnIdx_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(2, tsColumnIdx_); + } + if (fieldColumnIdx_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(3, fieldColumnIdx_); + } + if (java.lang.Double.doubleToRawLongBits(quantile_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(4, quantile_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof substrait_extension.PromqlPlan.HistogramFold)) { + return super.equals(obj); + } + substrait_extension.PromqlPlan.HistogramFold other = (substrait_extension.PromqlPlan.HistogramFold) obj; + + if (getLeColumnIdx() + != other.getLeColumnIdx()) return false; + if (getTsColumnIdx() + != other.getTsColumnIdx()) return false; + if (getFieldColumnIdx() + != other.getFieldColumnIdx()) return false; + if (java.lang.Double.doubleToLongBits(getQuantile()) + != java.lang.Double.doubleToLongBits( + other.getQuantile())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + LE_COLUMN_IDX_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getLeColumnIdx()); + hash = (37 * hash) + TS_COLUMN_IDX_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTsColumnIdx()); + hash = (37 * hash) + FIELD_COLUMN_IDX_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getFieldColumnIdx()); + hash = (37 * hash) + QUANTILE_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getQuantile())); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static substrait_extension.PromqlPlan.HistogramFold parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static substrait_extension.PromqlPlan.HistogramFold parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static substrait_extension.PromqlPlan.HistogramFold parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static substrait_extension.PromqlPlan.HistogramFold parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static substrait_extension.PromqlPlan.HistogramFold parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static substrait_extension.PromqlPlan.HistogramFold parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static substrait_extension.PromqlPlan.HistogramFold parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static substrait_extension.PromqlPlan.HistogramFold parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static substrait_extension.PromqlPlan.HistogramFold parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static substrait_extension.PromqlPlan.HistogramFold parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static substrait_extension.PromqlPlan.HistogramFold parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static substrait_extension.PromqlPlan.HistogramFold parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(substrait_extension.PromqlPlan.HistogramFold prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code substrait_extension.HistogramFold} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:substrait_extension.HistogramFold) + substrait_extension.PromqlPlan.HistogramFoldOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return substrait_extension.PromqlPlan.internal_static_substrait_extension_HistogramFold_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return substrait_extension.PromqlPlan.internal_static_substrait_extension_HistogramFold_fieldAccessorTable + .ensureFieldAccessorsInitialized( + substrait_extension.PromqlPlan.HistogramFold.class, substrait_extension.PromqlPlan.HistogramFold.Builder.class); + } + + // Construct using substrait_extension.PromqlPlan.HistogramFold.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + leColumnIdx_ = 0L; + + tsColumnIdx_ = 0L; + + fieldColumnIdx_ = 0L; + + quantile_ = 0D; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return substrait_extension.PromqlPlan.internal_static_substrait_extension_HistogramFold_descriptor; + } + + @java.lang.Override + public substrait_extension.PromqlPlan.HistogramFold getDefaultInstanceForType() { + return substrait_extension.PromqlPlan.HistogramFold.getDefaultInstance(); + } + + @java.lang.Override + public substrait_extension.PromqlPlan.HistogramFold build() { + substrait_extension.PromqlPlan.HistogramFold result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public substrait_extension.PromqlPlan.HistogramFold buildPartial() { + substrait_extension.PromqlPlan.HistogramFold result = new substrait_extension.PromqlPlan.HistogramFold(this); + result.leColumnIdx_ = leColumnIdx_; + result.tsColumnIdx_ = tsColumnIdx_; + result.fieldColumnIdx_ = fieldColumnIdx_; + result.quantile_ = quantile_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof substrait_extension.PromqlPlan.HistogramFold) { + return mergeFrom((substrait_extension.PromqlPlan.HistogramFold)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(substrait_extension.PromqlPlan.HistogramFold other) { + if (other == substrait_extension.PromqlPlan.HistogramFold.getDefaultInstance()) return this; + if (other.getLeColumnIdx() != 0L) { + setLeColumnIdx(other.getLeColumnIdx()); + } + if (other.getTsColumnIdx() != 0L) { + setTsColumnIdx(other.getTsColumnIdx()); + } + if (other.getFieldColumnIdx() != 0L) { + setFieldColumnIdx(other.getFieldColumnIdx()); + } + if (other.getQuantile() != 0D) { + setQuantile(other.getQuantile()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + substrait_extension.PromqlPlan.HistogramFold parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (substrait_extension.PromqlPlan.HistogramFold) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private long leColumnIdx_ ; + /** + *
+       * Column index of the `le` column (histogram bucket bounds)
+       * 
+ * + * uint64 le_column_idx = 1; + * @return The leColumnIdx. + */ + @java.lang.Override + public long getLeColumnIdx() { + return leColumnIdx_; + } + /** + *
+       * Column index of the `le` column (histogram bucket bounds)
+       * 
+ * + * uint64 le_column_idx = 1; + * @param value The leColumnIdx to set. + * @return This builder for chaining. + */ + public Builder setLeColumnIdx(long value) { + + leColumnIdx_ = value; + onChanged(); + return this; + } + /** + *
+       * Column index of the `le` column (histogram bucket bounds)
+       * 
+ * + * uint64 le_column_idx = 1; + * @return This builder for chaining. + */ + public Builder clearLeColumnIdx() { + + leColumnIdx_ = 0L; + onChanged(); + return this; + } + + private long tsColumnIdx_ ; + /** + *
+       * Column index of the timestamp column
+       * 
+ * + * uint64 ts_column_idx = 2; + * @return The tsColumnIdx. + */ + @java.lang.Override + public long getTsColumnIdx() { + return tsColumnIdx_; + } + /** + *
+       * Column index of the timestamp column
+       * 
+ * + * uint64 ts_column_idx = 2; + * @param value The tsColumnIdx to set. + * @return This builder for chaining. + */ + public Builder setTsColumnIdx(long value) { + + tsColumnIdx_ = value; + onChanged(); + return this; + } + /** + *
+       * Column index of the timestamp column
+       * 
+ * + * uint64 ts_column_idx = 2; + * @return This builder for chaining. + */ + public Builder clearTsColumnIdx() { + + tsColumnIdx_ = 0L; + onChanged(); + return this; + } + + private long fieldColumnIdx_ ; + /** + *
+       * Column index of the field column (histogram values)
+       * 
+ * + * uint64 field_column_idx = 3; + * @return The fieldColumnIdx. + */ + @java.lang.Override + public long getFieldColumnIdx() { + return fieldColumnIdx_; + } + /** + *
+       * Column index of the field column (histogram values)
+       * 
+ * + * uint64 field_column_idx = 3; + * @param value The fieldColumnIdx to set. + * @return This builder for chaining. + */ + public Builder setFieldColumnIdx(long value) { + + fieldColumnIdx_ = value; + onChanged(); + return this; + } + /** + *
+       * Column index of the field column (histogram values)
+       * 
+ * + * uint64 field_column_idx = 3; + * @return This builder for chaining. + */ + public Builder clearFieldColumnIdx() { + + fieldColumnIdx_ = 0L; + onChanged(); + return this; + } + + private double quantile_ ; + /** + *
+       * Quantile value
+       * 
+ * + * double quantile = 4; + * @return The quantile. + */ + @java.lang.Override + public double getQuantile() { + return quantile_; + } + /** + *
+       * Quantile value
+       * 
+ * + * double quantile = 4; + * @param value The quantile to set. + * @return This builder for chaining. + */ + public Builder setQuantile(double value) { + + quantile_ = value; + onChanged(); + return this; + } + /** + *
+       * Quantile value
+       * 
+ * + * double quantile = 4; + * @return This builder for chaining. + */ + public Builder clearQuantile() { + + quantile_ = 0D; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:substrait_extension.HistogramFold) + } + + // @@protoc_insertion_point(class_scope:substrait_extension.HistogramFold) + private static final substrait_extension.PromqlPlan.HistogramFold DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new substrait_extension.PromqlPlan.HistogramFold(); + } + + public static substrait_extension.PromqlPlan.HistogramFold getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public HistogramFold parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new HistogramFold(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public substrait_extension.PromqlPlan.HistogramFold getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface UnionDistinctOnOrBuilder extends + // @@protoc_insertion_point(interface_extends:substrait_extension.UnionDistinctOn) + com.google.protobuf.MessageOrBuilder { + + /** + *
+     * Indices of columns to compare for equality
+     * 
+ * + * repeated uint64 compare_key_indices = 1; + * @return A list containing the compareKeyIndices. + */ + java.util.List getCompareKeyIndicesList(); + /** + *
+     * Indices of columns to compare for equality
+     * 
+ * + * repeated uint64 compare_key_indices = 1; + * @return The count of compareKeyIndices. + */ + int getCompareKeyIndicesCount(); + /** + *
+     * Indices of columns to compare for equality
+     * 
+ * + * repeated uint64 compare_key_indices = 1; + * @param index The index of the element to return. + * @return The compareKeyIndices at the given index. + */ + long getCompareKeyIndices(int index); + + /** + *
+     * Column index of the timestamp column
+     * 
+ * + * uint64 ts_col_idx = 2; + * @return The tsColIdx. + */ + long getTsColIdx(); + } + /** + * Protobuf type {@code substrait_extension.UnionDistinctOn} + */ + public static final class UnionDistinctOn extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:substrait_extension.UnionDistinctOn) + UnionDistinctOnOrBuilder { + private static final long serialVersionUID = 0L; + // Use UnionDistinctOn.newBuilder() to construct. + private UnionDistinctOn(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private UnionDistinctOn() { + compareKeyIndices_ = emptyLongList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new UnionDistinctOn(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private UnionDistinctOn( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + compareKeyIndices_ = newLongList(); + mutable_bitField0_ |= 0x00000001; + } + compareKeyIndices_.addLong(input.readUInt64()); + break; + } + case 10: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) { + compareKeyIndices_ = newLongList(); + mutable_bitField0_ |= 0x00000001; + } + while (input.getBytesUntilLimit() > 0) { + compareKeyIndices_.addLong(input.readUInt64()); + } + input.popLimit(limit); + break; + } + case 16: { + + tsColIdx_ = input.readUInt64(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + compareKeyIndices_.makeImmutable(); // C + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return substrait_extension.PromqlPlan.internal_static_substrait_extension_UnionDistinctOn_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return substrait_extension.PromqlPlan.internal_static_substrait_extension_UnionDistinctOn_fieldAccessorTable + .ensureFieldAccessorsInitialized( + substrait_extension.PromqlPlan.UnionDistinctOn.class, substrait_extension.PromqlPlan.UnionDistinctOn.Builder.class); + } + + public static final int COMPARE_KEY_INDICES_FIELD_NUMBER = 1; + private com.google.protobuf.Internal.LongList compareKeyIndices_; + /** + *
+     * Indices of columns to compare for equality
+     * 
+ * + * repeated uint64 compare_key_indices = 1; + * @return A list containing the compareKeyIndices. + */ + @java.lang.Override + public java.util.List + getCompareKeyIndicesList() { + return compareKeyIndices_; + } + /** + *
+     * Indices of columns to compare for equality
+     * 
+ * + * repeated uint64 compare_key_indices = 1; + * @return The count of compareKeyIndices. + */ + public int getCompareKeyIndicesCount() { + return compareKeyIndices_.size(); + } + /** + *
+     * Indices of columns to compare for equality
+     * 
+ * + * repeated uint64 compare_key_indices = 1; + * @param index The index of the element to return. + * @return The compareKeyIndices at the given index. + */ + public long getCompareKeyIndices(int index) { + return compareKeyIndices_.getLong(index); + } + private int compareKeyIndicesMemoizedSerializedSize = -1; + + public static final int TS_COL_IDX_FIELD_NUMBER = 2; + private long tsColIdx_; + /** + *
+     * Column index of the timestamp column
+     * 
+ * + * uint64 ts_col_idx = 2; + * @return The tsColIdx. + */ + @java.lang.Override + public long getTsColIdx() { + return tsColIdx_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (getCompareKeyIndicesList().size() > 0) { + output.writeUInt32NoTag(10); + output.writeUInt32NoTag(compareKeyIndicesMemoizedSerializedSize); + } + for (int i = 0; i < compareKeyIndices_.size(); i++) { + output.writeUInt64NoTag(compareKeyIndices_.getLong(i)); + } + if (tsColIdx_ != 0L) { + output.writeUInt64(2, tsColIdx_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < compareKeyIndices_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeUInt64SizeNoTag(compareKeyIndices_.getLong(i)); + } + size += dataSize; + if (!getCompareKeyIndicesList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream + .computeInt32SizeNoTag(dataSize); + } + compareKeyIndicesMemoizedSerializedSize = dataSize; + } + if (tsColIdx_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(2, tsColIdx_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof substrait_extension.PromqlPlan.UnionDistinctOn)) { + return super.equals(obj); + } + substrait_extension.PromqlPlan.UnionDistinctOn other = (substrait_extension.PromqlPlan.UnionDistinctOn) obj; + + if (!getCompareKeyIndicesList() + .equals(other.getCompareKeyIndicesList())) return false; + if (getTsColIdx() + != other.getTsColIdx()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getCompareKeyIndicesCount() > 0) { + hash = (37 * hash) + COMPARE_KEY_INDICES_FIELD_NUMBER; + hash = (53 * hash) + getCompareKeyIndicesList().hashCode(); + } + hash = (37 * hash) + TS_COL_IDX_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTsColIdx()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static substrait_extension.PromqlPlan.UnionDistinctOn parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static substrait_extension.PromqlPlan.UnionDistinctOn parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static substrait_extension.PromqlPlan.UnionDistinctOn parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static substrait_extension.PromqlPlan.UnionDistinctOn parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static substrait_extension.PromqlPlan.UnionDistinctOn parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static substrait_extension.PromqlPlan.UnionDistinctOn parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static substrait_extension.PromqlPlan.UnionDistinctOn parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static substrait_extension.PromqlPlan.UnionDistinctOn parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static substrait_extension.PromqlPlan.UnionDistinctOn parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static substrait_extension.PromqlPlan.UnionDistinctOn parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static substrait_extension.PromqlPlan.UnionDistinctOn parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static substrait_extension.PromqlPlan.UnionDistinctOn parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(substrait_extension.PromqlPlan.UnionDistinctOn prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code substrait_extension.UnionDistinctOn} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:substrait_extension.UnionDistinctOn) + substrait_extension.PromqlPlan.UnionDistinctOnOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return substrait_extension.PromqlPlan.internal_static_substrait_extension_UnionDistinctOn_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return substrait_extension.PromqlPlan.internal_static_substrait_extension_UnionDistinctOn_fieldAccessorTable + .ensureFieldAccessorsInitialized( + substrait_extension.PromqlPlan.UnionDistinctOn.class, substrait_extension.PromqlPlan.UnionDistinctOn.Builder.class); + } + + // Construct using substrait_extension.PromqlPlan.UnionDistinctOn.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + compareKeyIndices_ = emptyLongList(); + bitField0_ = (bitField0_ & ~0x00000001); + tsColIdx_ = 0L; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return substrait_extension.PromqlPlan.internal_static_substrait_extension_UnionDistinctOn_descriptor; + } + + @java.lang.Override + public substrait_extension.PromqlPlan.UnionDistinctOn getDefaultInstanceForType() { + return substrait_extension.PromqlPlan.UnionDistinctOn.getDefaultInstance(); + } + + @java.lang.Override + public substrait_extension.PromqlPlan.UnionDistinctOn build() { + substrait_extension.PromqlPlan.UnionDistinctOn result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public substrait_extension.PromqlPlan.UnionDistinctOn buildPartial() { + substrait_extension.PromqlPlan.UnionDistinctOn result = new substrait_extension.PromqlPlan.UnionDistinctOn(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + compareKeyIndices_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.compareKeyIndices_ = compareKeyIndices_; + result.tsColIdx_ = tsColIdx_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof substrait_extension.PromqlPlan.UnionDistinctOn) { + return mergeFrom((substrait_extension.PromqlPlan.UnionDistinctOn)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(substrait_extension.PromqlPlan.UnionDistinctOn other) { + if (other == substrait_extension.PromqlPlan.UnionDistinctOn.getDefaultInstance()) return this; + if (!other.compareKeyIndices_.isEmpty()) { + if (compareKeyIndices_.isEmpty()) { + compareKeyIndices_ = other.compareKeyIndices_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureCompareKeyIndicesIsMutable(); + compareKeyIndices_.addAll(other.compareKeyIndices_); + } + onChanged(); + } + if (other.getTsColIdx() != 0L) { + setTsColIdx(other.getTsColIdx()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + substrait_extension.PromqlPlan.UnionDistinctOn parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (substrait_extension.PromqlPlan.UnionDistinctOn) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private com.google.protobuf.Internal.LongList compareKeyIndices_ = emptyLongList(); + private void ensureCompareKeyIndicesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + compareKeyIndices_ = mutableCopy(compareKeyIndices_); + bitField0_ |= 0x00000001; + } + } + /** + *
+       * Indices of columns to compare for equality
+       * 
+ * + * repeated uint64 compare_key_indices = 1; + * @return A list containing the compareKeyIndices. + */ + public java.util.List + getCompareKeyIndicesList() { + return ((bitField0_ & 0x00000001) != 0) ? + java.util.Collections.unmodifiableList(compareKeyIndices_) : compareKeyIndices_; + } + /** + *
+       * Indices of columns to compare for equality
+       * 
+ * + * repeated uint64 compare_key_indices = 1; + * @return The count of compareKeyIndices. + */ + public int getCompareKeyIndicesCount() { + return compareKeyIndices_.size(); + } + /** + *
+       * Indices of columns to compare for equality
+       * 
+ * + * repeated uint64 compare_key_indices = 1; + * @param index The index of the element to return. + * @return The compareKeyIndices at the given index. + */ + public long getCompareKeyIndices(int index) { + return compareKeyIndices_.getLong(index); + } + /** + *
+       * Indices of columns to compare for equality
+       * 
+ * + * repeated uint64 compare_key_indices = 1; + * @param index The index to set the value at. + * @param value The compareKeyIndices to set. + * @return This builder for chaining. + */ + public Builder setCompareKeyIndices( + int index, long value) { + ensureCompareKeyIndicesIsMutable(); + compareKeyIndices_.setLong(index, value); + onChanged(); + return this; + } + /** + *
+       * Indices of columns to compare for equality
+       * 
+ * + * repeated uint64 compare_key_indices = 1; + * @param value The compareKeyIndices to add. + * @return This builder for chaining. + */ + public Builder addCompareKeyIndices(long value) { + ensureCompareKeyIndicesIsMutable(); + compareKeyIndices_.addLong(value); + onChanged(); + return this; + } + /** + *
+       * Indices of columns to compare for equality
+       * 
+ * + * repeated uint64 compare_key_indices = 1; + * @param values The compareKeyIndices to add. + * @return This builder for chaining. + */ + public Builder addAllCompareKeyIndices( + java.lang.Iterable values) { + ensureCompareKeyIndicesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, compareKeyIndices_); + onChanged(); + return this; + } + /** + *
+       * Indices of columns to compare for equality
+       * 
+ * + * repeated uint64 compare_key_indices = 1; + * @return This builder for chaining. + */ + public Builder clearCompareKeyIndices() { + compareKeyIndices_ = emptyLongList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + private long tsColIdx_ ; + /** + *
+       * Column index of the timestamp column
+       * 
+ * + * uint64 ts_col_idx = 2; + * @return The tsColIdx. + */ + @java.lang.Override + public long getTsColIdx() { + return tsColIdx_; + } + /** + *
+       * Column index of the timestamp column
+       * 
+ * + * uint64 ts_col_idx = 2; + * @param value The tsColIdx to set. + * @return This builder for chaining. + */ + public Builder setTsColIdx(long value) { + + tsColIdx_ = value; + onChanged(); + return this; + } + /** + *
+       * Column index of the timestamp column
+       * 
+ * + * uint64 ts_col_idx = 2; + * @return This builder for chaining. + */ + public Builder clearTsColIdx() { + + tsColIdx_ = 0L; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:substrait_extension.UnionDistinctOn) + } + + // @@protoc_insertion_point(class_scope:substrait_extension.UnionDistinctOn) + private static final substrait_extension.PromqlPlan.UnionDistinctOn DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new substrait_extension.PromqlPlan.UnionDistinctOn(); + } + + public static substrait_extension.PromqlPlan.UnionDistinctOn getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UnionDistinctOn parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UnionDistinctOn(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public substrait_extension.PromqlPlan.UnionDistinctOn getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + private static final com.google.protobuf.Descriptors.Descriptor internal_static_substrait_extension_EmptyMetric_descriptor; private static final @@ -11006,6 +12551,16 @@ public final class PromqlPlan { private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_substrait_extension_LabelPair_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_substrait_extension_HistogramFold_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_substrait_extension_HistogramFold_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_substrait_extension_UnionDistinctOn_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_substrait_extension_UnionDistinctOn_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -11046,9 +12601,13 @@ public final class PromqlPlan { "labels\030\006 \003(\0132\036.substrait_extension.Label" + "Pair\022\035\n\025time_index_column_idx\030\007 \001(\004\022\030\n\020v" + "alue_column_idx\030\010 \001(\004\"\'\n\tLabelPair\022\013\n\003ke" + - "y\030\001 \001(\t\022\r\n\005value\030\002 \001(\tB?Z=github.com/Gre" + - "ptimeTeam/greptime-proto/go/substrait_ex" + - "tensionb\006proto3" + "y\030\001 \001(\t\022\r\n\005value\030\002 \001(\t\"i\n\rHistogramFold\022" + + "\025\n\rle_column_idx\030\001 \001(\004\022\025\n\rts_column_idx\030" + + "\002 \001(\004\022\030\n\020field_column_idx\030\003 \001(\004\022\020\n\010quant" + + "ile\030\004 \001(\001\"B\n\017UnionDistinctOn\022\033\n\023compare_" + + "key_indices\030\001 \003(\004\022\022\n\nts_col_idx\030\002 \001(\004B?Z" + + "=github.com/GreptimeTeam/greptime-proto/" + + "go/substrait_extensionb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -11102,6 +12661,18 @@ public final class PromqlPlan { com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_substrait_extension_LabelPair_descriptor, new java.lang.String[] { "Key", "Value", }); + internal_static_substrait_extension_HistogramFold_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_substrait_extension_HistogramFold_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_substrait_extension_HistogramFold_descriptor, + new java.lang.String[] { "LeColumnIdx", "TsColumnIdx", "FieldColumnIdx", "Quantile", }); + internal_static_substrait_extension_UnionDistinctOn_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_substrait_extension_UnionDistinctOn_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_substrait_extension_UnionDistinctOn_descriptor, + new java.lang.String[] { "CompareKeyIndices", "TsColIdx", }); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto/substrait_extension/promql_plan.proto b/proto/substrait_extension/promql_plan.proto index ab14ecb..4b134d0 100644 --- a/proto/substrait_extension/promql_plan.proto +++ b/proto/substrait_extension/promql_plan.proto @@ -148,3 +148,21 @@ message LabelPair { string key = 1; string value = 2; } + +message HistogramFold { + // Column index of the `le` column (histogram bucket bounds) + uint64 le_column_idx = 1; + // Column index of the timestamp column + uint64 ts_column_idx = 2; + // Column index of the field column (histogram values) + uint64 field_column_idx = 3; + // Quantile value + double quantile = 4; +} + +message UnionDistinctOn { + // Indices of columns to compare for equality + repeated uint64 compare_key_indices = 1; + // Column index of the timestamp column + uint64 ts_col_idx = 2; +}