From 28b1e2b92648dadabe53ba78ac4c6e2913534e8b Mon Sep 17 00:00:00 2001 From: Ruihang Xia Date: Wed, 21 May 2025 15:49:59 +0800 Subject: [PATCH] feat: add time index column to series divide plan Signed-off-by: Ruihang Xia --- c++/substrait_extension/promql_plan.pb.cc | 81 +++++-- c++/substrait_extension/promql_plan.pb.h | 66 ++++++ go/substrait_extension/promql_plan.pb.go | 70 +++--- .../java/substrait_extension/PromqlPlan.java | 209 +++++++++++++++++- proto/substrait_extension/promql_plan.proto | 2 + 5 files changed, 375 insertions(+), 53 deletions(-) diff --git a/c++/substrait_extension/promql_plan.pb.cc b/c++/substrait_extension/promql_plan.pb.cc index cbcac9a2..80d958e1 100644 --- a/c++/substrait_extension/promql_plan.pb.cc +++ b/c++/substrait_extension/promql_plan.pb.cc @@ -73,6 +73,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORIT PROTOBUF_CONSTEXPR SeriesDivide::SeriesDivide( ::_pbi::ConstantInitialized): _impl_{ /*decltype(_impl_.tag_columns_)*/{} + , /*decltype(_impl_.time_index_column_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} , /*decltype(_impl_._cached_size_)*/{}} {} struct SeriesDivideDefaultTypeInternal { PROTOBUF_CONSTEXPR SeriesDivideDefaultTypeInternal() @@ -163,6 +164,7 @@ const uint32_t TableStruct_substrait_5fextension_2fpromql_5fplan_2eproto::offset ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ PROTOBUF_FIELD_OFFSET(::substrait_extension::SeriesDivide, _impl_.tag_columns_), + PROTOBUF_FIELD_OFFSET(::substrait_extension::SeriesDivide, _impl_.time_index_column_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::substrait_extension::RangeManipulate, _internal_metadata_), ~0u, // no _extensions_ @@ -193,8 +195,8 @@ static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protode { 9, -1, -1, sizeof(::substrait_extension::InstantManipulate)}, { 21, -1, -1, sizeof(::substrait_extension::SeriesNormalize)}, { 31, -1, -1, sizeof(::substrait_extension::SeriesDivide)}, - { 38, -1, -1, sizeof(::substrait_extension::RangeManipulate)}, - { 50, -1, -1, sizeof(::substrait_extension::ScalarCalculate)}, + { 39, -1, -1, sizeof(::substrait_extension::RangeManipulate)}, + { 51, -1, -1, sizeof(::substrait_extension::ScalarCalculate)}, }; static const ::_pb::Message* const file_default_instances[] = { @@ -215,20 +217,21 @@ const char descriptor_table_protodef_substrait_5fextension_2fpromql_5fplan_2epro "k_delta\030\004 \001(\003\022\022\n\ntime_index\030\005 \001(\t\022\023\n\013fie" "ld_index\030\006 \001(\t\"^\n\017SeriesNormalize\022\016\n\006off" "set\030\001 \001(\003\022\022\n\ntime_index\030\002 \001(\t\022\022\n\nfilter_" - "nan\030\003 \001(\010\022\023\n\013tag_columns\030\004 \003(\t\"#\n\014Series" - "Divide\022\023\n\013tag_columns\030\001 \003(\t\"w\n\017RangeMani" - "pulate\022\r\n\005start\030\001 \001(\003\022\013\n\003end\030\002 \001(\003\022\020\n\010in" - "terval\030\003 \001(\003\022\r\n\005range\030\004 \001(\003\022\022\n\ntime_inde" - "x\030\005 \001(\t\022\023\n\013tag_columns\030\006 \003(\t\"~\n\017ScalarCa" - "lculate\022\r\n\005start\030\001 \001(\003\022\013\n\003end\030\002 \001(\003\022\020\n\010i" - "nterval\030\003 \001(\003\022\022\n\ntime_index\030\005 \001(\t\022\023\n\013tag" - "_columns\030\006 \003(\t\022\024\n\014field_column\030\007 \001(\tB\?Z=" - "github.com/GreptimeTeam/greptime-proto/g" - "o/substrait_extensionb\006proto3" + "nan\030\003 \001(\010\022\023\n\013tag_columns\030\004 \003(\t\">\n\014Series" + "Divide\022\023\n\013tag_columns\030\001 \003(\t\022\031\n\021time_inde" + "x_column\030\002 \001(\t\"w\n\017RangeManipulate\022\r\n\005sta" + "rt\030\001 \001(\003\022\013\n\003end\030\002 \001(\003\022\020\n\010interval\030\003 \001(\003\022" + "\r\n\005range\030\004 \001(\003\022\022\n\ntime_index\030\005 \001(\t\022\023\n\013ta" + "g_columns\030\006 \003(\t\"~\n\017ScalarCalculate\022\r\n\005st" + "art\030\001 \001(\003\022\013\n\003end\030\002 \001(\003\022\020\n\010interval\030\003 \001(\003" + "\022\022\n\ntime_index\030\005 \001(\t\022\023\n\013tag_columns\030\006 \003(" + "\t\022\024\n\014field_column\030\007 \001(\tB\?Z=github.com/Gr" + "eptimeTeam/greptime-proto/go/substrait_e" + "xtensionb\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, 709, descriptor_table_protodef_substrait_5fextension_2fpromql_5fplan_2eproto, + false, false, 736, descriptor_table_protodef_substrait_5fextension_2fpromql_5fplan_2eproto, "substrait_extension/promql_plan.proto", &descriptor_table_substrait_5fextension_2fpromql_5fplan_2eproto_once, nullptr, 0, 6, schemas, file_default_instances, TableStruct_substrait_5fextension_2fpromql_5fplan_2eproto::offsets, @@ -1158,9 +1161,18 @@ SeriesDivide::SeriesDivide(const SeriesDivide& from) SeriesDivide* const _this = this; (void)_this; new (&_impl_) Impl_{ decltype(_impl_.tag_columns_){from._impl_.tag_columns_} + , decltype(_impl_.time_index_column_){} , /*decltype(_impl_._cached_size_)*/{}}; _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + _impl_.time_index_column_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.time_index_column_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_time_index_column().empty()) { + _this->_impl_.time_index_column_.Set(from._internal_time_index_column(), + _this->GetArenaForAllocation()); + } // @@protoc_insertion_point(copy_constructor:substrait_extension.SeriesDivide) } @@ -1170,8 +1182,13 @@ inline void SeriesDivide::SharedCtor( (void)is_message_owned; new (&_impl_) Impl_{ decltype(_impl_.tag_columns_){arena} + , decltype(_impl_.time_index_column_){} , /*decltype(_impl_._cached_size_)*/{} }; + _impl_.time_index_column_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.time_index_column_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING } SeriesDivide::~SeriesDivide() { @@ -1186,6 +1203,7 @@ SeriesDivide::~SeriesDivide() { inline void SeriesDivide::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); _impl_.tag_columns_.~RepeatedPtrField(); + _impl_.time_index_column_.Destroy(); } void SeriesDivide::SetCachedSize(int size) const { @@ -1199,6 +1217,7 @@ void SeriesDivide::Clear() { (void) cached_has_bits; _impl_.tag_columns_.Clear(); + _impl_.time_index_column_.ClearToEmpty(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } @@ -1223,6 +1242,16 @@ const char* SeriesDivide::_InternalParse(const char* ptr, ::_pbi::ParseContext* } else goto handle_unusual; continue; + // string time_index_column = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + auto str = _internal_mutable_time_index_column(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + CHK_(::_pbi::VerifyUTF8(str, "substrait_extension.SeriesDivide.time_index_column")); + } else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -1262,6 +1291,16 @@ uint8_t* SeriesDivide::_InternalSerialize( target = stream->WriteString(1, s, target); } + // string time_index_column = 2; + if (!this->_internal_time_index_column().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_time_index_column().data(), static_cast(this->_internal_time_index_column().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "substrait_extension.SeriesDivide.time_index_column"); + target = stream->WriteStringMaybeAliased( + 2, this->_internal_time_index_column(), 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); @@ -1286,6 +1325,13 @@ size_t SeriesDivide::ByteSizeLong() const { _impl_.tag_columns_.Get(i)); } + // string time_index_column = 2; + if (!this->_internal_time_index_column().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_time_index_column()); + } + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } @@ -1305,6 +1351,9 @@ void SeriesDivide::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::P (void) cached_has_bits; _this->_impl_.tag_columns_.MergeFrom(from._impl_.tag_columns_); + if (!from._internal_time_index_column().empty()) { + _this->_internal_set_time_index_column(from._internal_time_index_column()); + } _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -1321,8 +1370,14 @@ bool SeriesDivide::IsInitialized() const { void SeriesDivide::InternalSwap(SeriesDivide* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); _impl_.tag_columns_.InternalSwap(&other->_impl_.tag_columns_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.time_index_column_, lhs_arena, + &other->_impl_.time_index_column_, rhs_arena + ); } ::PROTOBUF_NAMESPACE_ID::Metadata SeriesDivide::GetMetadata() const { diff --git a/c++/substrait_extension/promql_plan.pb.h b/c++/substrait_extension/promql_plan.pb.h index bc2a3137..05c47194 100644 --- a/c++/substrait_extension/promql_plan.pb.h +++ b/c++/substrait_extension/promql_plan.pb.h @@ -782,6 +782,7 @@ class SeriesDivide final : enum : int { kTagColumnsFieldNumber = 1, + kTimeIndexColumnFieldNumber = 2, }; // repeated string tag_columns = 1; int tag_columns_size() const; @@ -807,6 +808,20 @@ class SeriesDivide final : std::string* _internal_add_tag_columns(); public: + // string time_index_column = 2; + void clear_time_index_column(); + const std::string& time_index_column() const; + template + void set_time_index_column(ArgT0&& arg0, ArgT... args); + std::string* mutable_time_index_column(); + PROTOBUF_NODISCARD std::string* release_time_index_column(); + void set_allocated_time_index_column(std::string* time_index_column); + private: + const std::string& _internal_time_index_column() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_time_index_column(const std::string& value); + std::string* _internal_mutable_time_index_column(); + public: + // @@protoc_insertion_point(class_scope:substrait_extension.SeriesDivide) private: class _Internal; @@ -816,6 +831,7 @@ class SeriesDivide final : typedef void DestructorSkippable_; struct Impl_ { ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField tag_columns_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr time_index_column_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union { Impl_ _impl_; }; @@ -1775,6 +1791,56 @@ SeriesDivide::mutable_tag_columns() { return &_impl_.tag_columns_; } +// string time_index_column = 2; +inline void SeriesDivide::clear_time_index_column() { + _impl_.time_index_column_.ClearToEmpty(); +} +inline const std::string& SeriesDivide::time_index_column() const { + // @@protoc_insertion_point(field_get:substrait_extension.SeriesDivide.time_index_column) + return _internal_time_index_column(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SeriesDivide::set_time_index_column(ArgT0&& arg0, ArgT... args) { + + _impl_.time_index_column_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:substrait_extension.SeriesDivide.time_index_column) +} +inline std::string* SeriesDivide::mutable_time_index_column() { + std::string* _s = _internal_mutable_time_index_column(); + // @@protoc_insertion_point(field_mutable:substrait_extension.SeriesDivide.time_index_column) + return _s; +} +inline const std::string& SeriesDivide::_internal_time_index_column() const { + return _impl_.time_index_column_.Get(); +} +inline void SeriesDivide::_internal_set_time_index_column(const std::string& value) { + + _impl_.time_index_column_.Set(value, GetArenaForAllocation()); +} +inline std::string* SeriesDivide::_internal_mutable_time_index_column() { + + return _impl_.time_index_column_.Mutable(GetArenaForAllocation()); +} +inline std::string* SeriesDivide::release_time_index_column() { + // @@protoc_insertion_point(field_release:substrait_extension.SeriesDivide.time_index_column) + return _impl_.time_index_column_.Release(); +} +inline void SeriesDivide::set_allocated_time_index_column(std::string* time_index_column) { + if (time_index_column != nullptr) { + + } else { + + } + _impl_.time_index_column_.SetAllocated(time_index_column, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.time_index_column_.IsDefault()) { + _impl_.time_index_column_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:substrait_extension.SeriesDivide.time_index_column) +} + // ------------------------------------------------------------------- // RangeManipulate diff --git a/go/substrait_extension/promql_plan.pb.go b/go/substrait_extension/promql_plan.pb.go index c5ae070e..fb5d8f86 100644 --- a/go/substrait_extension/promql_plan.pb.go +++ b/go/substrait_extension/promql_plan.pb.go @@ -275,6 +275,8 @@ type SeriesDivide struct { // Names of tag columns TagColumns []string `protobuf:"bytes,1,rep,name=tag_columns,json=tagColumns,proto3" json:"tag_columns,omitempty"` + // Name of time index column + TimeIndexColumn string `protobuf:"bytes,2,opt,name=time_index_column,json=timeIndexColumn,proto3" json:"time_index_column,omitempty"` } func (x *SeriesDivide) Reset() { @@ -316,6 +318,13 @@ func (x *SeriesDivide) GetTagColumns() []string { return nil } +func (x *SeriesDivide) GetTimeIndexColumn() string { + if x != nil { + return x.TimeIndexColumn + } + return "" +} + type RangeManipulate struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -534,37 +543,40 @@ var file_substrait_extension_promql_plan_proto_rawDesc = []byte{ 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x67, 0x5f, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x0a, 0x74, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x22, 0x2f, 0x0a, 0x0c, 0x53, + 0x0a, 0x74, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x22, 0x5b, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x69, 0x65, 0x73, 0x44, 0x69, 0x76, 0x69, 0x64, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x67, 0x5f, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x0a, 0x74, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x22, 0xab, 0x01, 0x0a, - 0x0f, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x6e, 0x69, 0x70, 0x75, 0x6c, 0x61, 0x74, 0x65, - 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x76, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x76, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x69, - 0x6d, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x74, 0x69, 0x6d, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x67, - 0x5f, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, - 0x74, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x22, 0xb8, 0x01, 0x0a, 0x0f, 0x53, - 0x63, 0x61, 0x6c, 0x61, 0x72, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x14, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, - 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, - 0x61, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x49, 0x6e, 0x64, 0x65, - 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x67, 0x5f, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, - 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x75, 0x6d, - 0x6e, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x75, - 0x6d, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x43, - 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 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, + 0x52, 0x0a, 0x74, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x2a, 0x0a, 0x11, + 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x63, 0x6f, 0x6c, 0x75, 0x6d, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x69, 0x6d, 0x65, 0x49, 0x6e, 0x64, + 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x22, 0xab, 0x01, 0x0a, 0x0f, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x4d, 0x61, 0x6e, 0x69, 0x70, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x03, 0x65, 0x6e, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, + 0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, + 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x67, 0x5f, 0x63, 0x6f, 0x6c, + 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x67, 0x43, + 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x22, 0xb8, 0x01, 0x0a, 0x0f, 0x53, 0x63, 0x61, 0x6c, 0x61, + 0x72, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x65, + 0x6e, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x1d, + 0x0a, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1f, 0x0a, + 0x0b, 0x74, 0x61, 0x67, 0x5f, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x21, + 0x0a, 0x0c, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6c, 0x75, 0x6d, + 0x6e, 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 ( diff --git a/java/src/main/java/substrait_extension/PromqlPlan.java b/java/src/main/java/substrait_extension/PromqlPlan.java index 267485b5..ab56d50e 100644 --- a/java/src/main/java/substrait_extension/PromqlPlan.java +++ b/java/src/main/java/substrait_extension/PromqlPlan.java @@ -2983,6 +2983,26 @@ public interface SeriesDivideOrBuilder extends */ com.google.protobuf.ByteString getTagColumnsBytes(int index); + + /** + *
+     * Name of time index column
+     * 
+ * + * string time_index_column = 2; + * @return The timeIndexColumn. + */ + java.lang.String getTimeIndexColumn(); + /** + *
+     * Name of time index column
+     * 
+ * + * string time_index_column = 2; + * @return The bytes for timeIndexColumn. + */ + com.google.protobuf.ByteString + getTimeIndexColumnBytes(); } /** * Protobuf type {@code substrait_extension.SeriesDivide} @@ -2998,6 +3018,7 @@ private SeriesDivide(com.google.protobuf.GeneratedMessageV3.Builder builder) } private SeriesDivide() { tagColumns_ = com.google.protobuf.LazyStringArrayList.EMPTY; + timeIndexColumn_ = ""; } @java.lang.Override @@ -3040,6 +3061,12 @@ private SeriesDivide( tagColumns_.add(s); break; } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + timeIndexColumn_ = s; + break; + } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { @@ -3128,6 +3155,52 @@ public java.lang.String getTagColumns(int index) { return tagColumns_.getByteString(index); } + public static final int TIME_INDEX_COLUMN_FIELD_NUMBER = 2; + private volatile java.lang.Object timeIndexColumn_; + /** + *
+     * Name of time index column
+     * 
+ * + * string time_index_column = 2; + * @return The timeIndexColumn. + */ + @java.lang.Override + public java.lang.String getTimeIndexColumn() { + java.lang.Object ref = timeIndexColumn_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + timeIndexColumn_ = s; + return s; + } + } + /** + *
+     * Name of time index column
+     * 
+ * + * string time_index_column = 2; + * @return The bytes for timeIndexColumn. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTimeIndexColumnBytes() { + java.lang.Object ref = timeIndexColumn_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + timeIndexColumn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -3145,6 +3218,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) for (int i = 0; i < tagColumns_.size(); i++) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, tagColumns_.getRaw(i)); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(timeIndexColumn_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, timeIndexColumn_); + } unknownFields.writeTo(output); } @@ -3162,6 +3238,9 @@ public int getSerializedSize() { size += dataSize; size += 1 * getTagColumnsList().size(); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(timeIndexColumn_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, timeIndexColumn_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -3179,6 +3258,8 @@ public boolean equals(final java.lang.Object obj) { if (!getTagColumnsList() .equals(other.getTagColumnsList())) return false; + if (!getTimeIndexColumn() + .equals(other.getTimeIndexColumn())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -3194,6 +3275,8 @@ public int hashCode() { hash = (37 * hash) + TAG_COLUMNS_FIELD_NUMBER; hash = (53 * hash) + getTagColumnsList().hashCode(); } + hash = (37 * hash) + TIME_INDEX_COLUMN_FIELD_NUMBER; + hash = (53 * hash) + getTimeIndexColumn().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -3329,6 +3412,8 @@ public Builder clear() { super.clear(); tagColumns_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000001); + timeIndexColumn_ = ""; + return this; } @@ -3361,6 +3446,7 @@ public substrait_extension.PromqlPlan.SeriesDivide buildPartial() { bitField0_ = (bitField0_ & ~0x00000001); } result.tagColumns_ = tagColumns_; + result.timeIndexColumn_ = timeIndexColumn_; onBuilt(); return result; } @@ -3419,6 +3505,10 @@ public Builder mergeFrom(substrait_extension.PromqlPlan.SeriesDivide other) { } onChanged(); } + if (!other.getTimeIndexColumn().isEmpty()) { + timeIndexColumn_ = other.timeIndexColumn_; + onChanged(); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -3594,6 +3684,102 @@ public Builder addTagColumnsBytes( onChanged(); return this; } + + private java.lang.Object timeIndexColumn_ = ""; + /** + *
+       * Name of time index column
+       * 
+ * + * string time_index_column = 2; + * @return The timeIndexColumn. + */ + public java.lang.String getTimeIndexColumn() { + java.lang.Object ref = timeIndexColumn_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + timeIndexColumn_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+       * Name of time index column
+       * 
+ * + * string time_index_column = 2; + * @return The bytes for timeIndexColumn. + */ + public com.google.protobuf.ByteString + getTimeIndexColumnBytes() { + java.lang.Object ref = timeIndexColumn_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + timeIndexColumn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+       * Name of time index column
+       * 
+ * + * string time_index_column = 2; + * @param value The timeIndexColumn to set. + * @return This builder for chaining. + */ + public Builder setTimeIndexColumn( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + timeIndexColumn_ = value; + onChanged(); + return this; + } + /** + *
+       * Name of time index column
+       * 
+ * + * string time_index_column = 2; + * @return This builder for chaining. + */ + public Builder clearTimeIndexColumn() { + + timeIndexColumn_ = getDefaultInstance().getTimeIndexColumn(); + onChanged(); + return this; + } + /** + *
+       * Name of time index column
+       * 
+ * + * string time_index_column = 2; + * @param value The bytes for timeIndexColumn to set. + * @return This builder for chaining. + */ + public Builder setTimeIndexColumnBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + timeIndexColumn_ = value; + onChanged(); + return this; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { @@ -6305,16 +6491,17 @@ public substrait_extension.PromqlPlan.ScalarCalculate getDefaultInstanceForType( "k_delta\030\004 \001(\003\022\022\n\ntime_index\030\005 \001(\t\022\023\n\013fie" + "ld_index\030\006 \001(\t\"^\n\017SeriesNormalize\022\016\n\006off" + "set\030\001 \001(\003\022\022\n\ntime_index\030\002 \001(\t\022\022\n\nfilter_" + - "nan\030\003 \001(\010\022\023\n\013tag_columns\030\004 \003(\t\"#\n\014Series" + - "Divide\022\023\n\013tag_columns\030\001 \003(\t\"w\n\017RangeMani" + - "pulate\022\r\n\005start\030\001 \001(\003\022\013\n\003end\030\002 \001(\003\022\020\n\010in" + - "terval\030\003 \001(\003\022\r\n\005range\030\004 \001(\003\022\022\n\ntime_inde" + - "x\030\005 \001(\t\022\023\n\013tag_columns\030\006 \003(\t\"~\n\017ScalarCa" + - "lculate\022\r\n\005start\030\001 \001(\003\022\013\n\003end\030\002 \001(\003\022\020\n\010i" + - "nterval\030\003 \001(\003\022\022\n\ntime_index\030\005 \001(\t\022\023\n\013tag" + - "_columns\030\006 \003(\t\022\024\n\014field_column\030\007 \001(\tB?Z=" + - "github.com/GreptimeTeam/greptime-proto/g" + - "o/substrait_extensionb\006proto3" + "nan\030\003 \001(\010\022\023\n\013tag_columns\030\004 \003(\t\">\n\014Series" + + "Divide\022\023\n\013tag_columns\030\001 \003(\t\022\031\n\021time_inde" + + "x_column\030\002 \001(\t\"w\n\017RangeManipulate\022\r\n\005sta" + + "rt\030\001 \001(\003\022\013\n\003end\030\002 \001(\003\022\020\n\010interval\030\003 \001(\003\022" + + "\r\n\005range\030\004 \001(\003\022\022\n\ntime_index\030\005 \001(\t\022\023\n\013ta" + + "g_columns\030\006 \003(\t\"~\n\017ScalarCalculate\022\r\n\005st" + + "art\030\001 \001(\003\022\013\n\003end\030\002 \001(\003\022\020\n\010interval\030\003 \001(\003" + + "\022\022\n\ntime_index\030\005 \001(\t\022\023\n\013tag_columns\030\006 \003(" + + "\t\022\024\n\014field_column\030\007 \001(\tB?Z=github.com/Gr" + + "eptimeTeam/greptime-proto/go/substrait_e" + + "xtensionb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -6343,7 +6530,7 @@ public substrait_extension.PromqlPlan.ScalarCalculate getDefaultInstanceForType( internal_static_substrait_extension_SeriesDivide_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_substrait_extension_SeriesDivide_descriptor, - new java.lang.String[] { "TagColumns", }); + new java.lang.String[] { "TagColumns", "TimeIndexColumn", }); internal_static_substrait_extension_RangeManipulate_descriptor = getDescriptor().getMessageTypes().get(4); internal_static_substrait_extension_RangeManipulate_fieldAccessorTable = new diff --git a/proto/substrait_extension/promql_plan.proto b/proto/substrait_extension/promql_plan.proto index 70930cc4..6c989793 100644 --- a/proto/substrait_extension/promql_plan.proto +++ b/proto/substrait_extension/promql_plan.proto @@ -56,6 +56,8 @@ message SeriesNormalize { message SeriesDivide { // Names of tag columns repeated string tag_columns = 1; + // Name of time index column + string time_index_column = 2; } message RangeManipulate {