From ff58262ba48cd3365db546b0164b6e2a00379d52 Mon Sep 17 00:00:00 2001 From: WUJingdi Date: Wed, 17 Apr 2024 11:03:35 +0800 Subject: [PATCH] feat: PromQL ScalarCalculate plan --- c++/substrait_extension/promql_plan.pb.cc | 426 ++++- c++/substrait_extension/promql_plan.pb.h | 473 ++++++ go/substrait_extension/promql_plan.pb.go | 133 +- .../java/substrait_extension/PromqlPlan.java | 1372 ++++++++++++++++- proto/substrait_extension/promql_plan.proto | 15 + 5 files changed, 2404 insertions(+), 15 deletions(-) diff --git a/c++/substrait_extension/promql_plan.pb.cc b/c++/substrait_extension/promql_plan.pb.cc index 1c12a4e4..800565c4 100644 --- a/c++/substrait_extension/promql_plan.pb.cc +++ b/c++/substrait_extension/promql_plan.pb.cc @@ -100,8 +100,26 @@ struct RangeManipulateDefaultTypeInternal { }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 RangeManipulateDefaultTypeInternal _RangeManipulate_default_instance_; +PROTOBUF_CONSTEXPR ScalarCalculate::ScalarCalculate( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_.tag_columns_)*/{} + , /*decltype(_impl_.time_index_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.field_column_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.start_)*/int64_t{0} + , /*decltype(_impl_.end_)*/int64_t{0} + , /*decltype(_impl_.interval_)*/int64_t{0} + , /*decltype(_impl_._cached_size_)*/{}} {} +struct ScalarCalculateDefaultTypeInternal { + PROTOBUF_CONSTEXPR ScalarCalculateDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~ScalarCalculateDefaultTypeInternal() {} + union { + ScalarCalculate _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ScalarCalculateDefaultTypeInternal _ScalarCalculate_default_instance_; } // namespace substrait_extension -static ::_pb::Metadata file_level_metadata_substrait_5fextension_2fpromql_5fplan_2eproto[5]; +static ::_pb::Metadata file_level_metadata_substrait_5fextension_2fpromql_5fplan_2eproto[6]; 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; @@ -155,6 +173,18 @@ const uint32_t TableStruct_substrait_5fextension_2fpromql_5fplan_2eproto::offset PROTOBUF_FIELD_OFFSET(::substrait_extension::RangeManipulate, _impl_.range_), PROTOBUF_FIELD_OFFSET(::substrait_extension::RangeManipulate, _impl_.time_index_), PROTOBUF_FIELD_OFFSET(::substrait_extension::RangeManipulate, _impl_.tag_columns_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::substrait_extension::ScalarCalculate, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::substrait_extension::ScalarCalculate, _impl_.start_), + PROTOBUF_FIELD_OFFSET(::substrait_extension::ScalarCalculate, _impl_.end_), + PROTOBUF_FIELD_OFFSET(::substrait_extension::ScalarCalculate, _impl_.interval_), + PROTOBUF_FIELD_OFFSET(::substrait_extension::ScalarCalculate, _impl_.time_index_), + PROTOBUF_FIELD_OFFSET(::substrait_extension::ScalarCalculate, _impl_.tag_columns_), + PROTOBUF_FIELD_OFFSET(::substrait_extension::ScalarCalculate, _impl_.field_column_), }; static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, -1, -1, sizeof(::substrait_extension::EmptyMetric)}, @@ -162,6 +192,7 @@ static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protode { 21, -1, -1, sizeof(::substrait_extension::SeriesNormalize)}, { 30, -1, -1, sizeof(::substrait_extension::SeriesDivide)}, { 37, -1, -1, sizeof(::substrait_extension::RangeManipulate)}, + { 49, -1, -1, sizeof(::substrait_extension::ScalarCalculate)}, }; static const ::_pb::Message* const file_default_instances[] = { @@ -170,6 +201,7 @@ static const ::_pb::Message* const file_default_instances[] = { &::substrait_extension::_SeriesNormalize_default_instance_._instance, &::substrait_extension::_SeriesDivide_default_instance_._instance, &::substrait_extension::_RangeManipulate_default_instance_._instance, + &::substrait_extension::_ScalarCalculate_default_instance_._instance, }; const char descriptor_table_protodef_substrait_5fextension_2fpromql_5fplan_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = @@ -185,14 +217,18 @@ const char descriptor_table_protodef_substrait_5fextension_2fpromql_5fplan_2epro "\030\001 \003(\t\"w\n\017RangeManipulate\022\r\n\005start\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\013tag_column" - "s\030\006 \003(\tB\?Z=github.com/GreptimeTeam/grept" - "ime-proto/go/substrait_extensionb\006proto3" + "s\030\006 \003(\t\"~\n\017ScalarCalculate\022\r\n\005start\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\014fie" + "ld_column\030\007 \001(\tB\?Z=github.com/GreptimeTe" + "am/greptime-proto/go/substrait_extension" + "b\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, 560, descriptor_table_protodef_substrait_5fextension_2fpromql_5fplan_2eproto, + false, false, 688, descriptor_table_protodef_substrait_5fextension_2fpromql_5fplan_2eproto, "substrait_extension/promql_plan.proto", - &descriptor_table_substrait_5fextension_2fpromql_5fplan_2eproto_once, nullptr, 0, 5, + &descriptor_table_substrait_5fextension_2fpromql_5fplan_2eproto_once, nullptr, 0, 6, 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, @@ -1604,6 +1640,382 @@ ::PROTOBUF_NAMESPACE_ID::Metadata RangeManipulate::GetMetadata() const { file_level_metadata_substrait_5fextension_2fpromql_5fplan_2eproto[4]); } +// =================================================================== + +class ScalarCalculate::_Internal { + public: +}; + +ScalarCalculate::ScalarCalculate(::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.ScalarCalculate) +} +ScalarCalculate::ScalarCalculate(const ScalarCalculate& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + ScalarCalculate* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_.tag_columns_){from._impl_.tag_columns_} + , decltype(_impl_.time_index_){} + , decltype(_impl_.field_column_){} + , decltype(_impl_.start_){} + , decltype(_impl_.end_){} + , decltype(_impl_.interval_){} + , /*decltype(_impl_._cached_size_)*/{}}; + + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + _impl_.time_index_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.time_index_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_time_index().empty()) { + _this->_impl_.time_index_.Set(from._internal_time_index(), + _this->GetArenaForAllocation()); + } + _impl_.field_column_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.field_column_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_field_column().empty()) { + _this->_impl_.field_column_.Set(from._internal_field_column(), + _this->GetArenaForAllocation()); + } + ::memcpy(&_impl_.start_, &from._impl_.start_, + static_cast(reinterpret_cast(&_impl_.interval_) - + reinterpret_cast(&_impl_.start_)) + sizeof(_impl_.interval_)); + // @@protoc_insertion_point(copy_constructor:substrait_extension.ScalarCalculate) +} + +inline void ScalarCalculate::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_.tag_columns_){arena} + , decltype(_impl_.time_index_){} + , decltype(_impl_.field_column_){} + , decltype(_impl_.start_){int64_t{0}} + , decltype(_impl_.end_){int64_t{0}} + , decltype(_impl_.interval_){int64_t{0}} + , /*decltype(_impl_._cached_size_)*/{} + }; + _impl_.time_index_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.time_index_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.field_column_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.field_column_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +ScalarCalculate::~ScalarCalculate() { + // @@protoc_insertion_point(destructor:substrait_extension.ScalarCalculate) + if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void ScalarCalculate::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.tag_columns_.~RepeatedPtrField(); + _impl_.time_index_.Destroy(); + _impl_.field_column_.Destroy(); +} + +void ScalarCalculate::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void ScalarCalculate::Clear() { +// @@protoc_insertion_point(message_clear_start:substrait_extension.ScalarCalculate) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.tag_columns_.Clear(); + _impl_.time_index_.ClearToEmpty(); + _impl_.field_column_.ClearToEmpty(); + ::memset(&_impl_.start_, 0, static_cast( + reinterpret_cast(&_impl_.interval_) - + reinterpret_cast(&_impl_.start_)) + sizeof(_impl_.interval_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* ScalarCalculate::_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) { + // int64 start = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _impl_.start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // int64 end = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _impl_.end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // int64 interval = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _impl_.interval_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string time_index = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) { + auto str = _internal_mutable_time_index(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + CHK_(::_pbi::VerifyUTF8(str, "substrait_extension.ScalarCalculate.time_index")); + } else + goto handle_unusual; + continue; + // repeated string tag_columns = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) { + ptr -= 1; + do { + ptr += 1; + auto str = _internal_add_tag_columns(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + CHK_(::_pbi::VerifyUTF8(str, "substrait_extension.ScalarCalculate.tag_columns")); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr)); + } else + goto handle_unusual; + continue; + // string field_column = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) { + auto str = _internal_mutable_field_column(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + CHK_(::_pbi::VerifyUTF8(str, "substrait_extension.ScalarCalculate.field_column")); + } 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* ScalarCalculate::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:substrait_extension.ScalarCalculate) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // int64 start = 1; + if (this->_internal_start() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt64ToArray(1, this->_internal_start(), target); + } + + // int64 end = 2; + if (this->_internal_end() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt64ToArray(2, this->_internal_end(), target); + } + + // int64 interval = 3; + if (this->_internal_interval() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt64ToArray(3, this->_internal_interval(), target); + } + + // string time_index = 5; + if (!this->_internal_time_index().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_time_index().data(), static_cast(this->_internal_time_index().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "substrait_extension.ScalarCalculate.time_index"); + target = stream->WriteStringMaybeAliased( + 5, this->_internal_time_index(), target); + } + + // repeated string tag_columns = 6; + for (int i = 0, n = this->_internal_tag_columns_size(); i < n; i++) { + const auto& s = this->_internal_tag_columns(i); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + s.data(), static_cast(s.length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "substrait_extension.ScalarCalculate.tag_columns"); + target = stream->WriteString(6, s, target); + } + + // string field_column = 7; + if (!this->_internal_field_column().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_field_column().data(), static_cast(this->_internal_field_column().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "substrait_extension.ScalarCalculate.field_column"); + target = stream->WriteStringMaybeAliased( + 7, this->_internal_field_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); + } + // @@protoc_insertion_point(serialize_to_array_end:substrait_extension.ScalarCalculate) + return target; +} + +size_t ScalarCalculate::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:substrait_extension.ScalarCalculate) + 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 string tag_columns = 6; + total_size += 1 * + ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(_impl_.tag_columns_.size()); + for (int i = 0, n = _impl_.tag_columns_.size(); i < n; i++) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + _impl_.tag_columns_.Get(i)); + } + + // string time_index = 5; + if (!this->_internal_time_index().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_time_index()); + } + + // string field_column = 7; + if (!this->_internal_field_column().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_field_column()); + } + + // int64 start = 1; + if (this->_internal_start() != 0) { + total_size += ::_pbi::WireFormatLite::Int64SizePlusOne(this->_internal_start()); + } + + // int64 end = 2; + if (this->_internal_end() != 0) { + total_size += ::_pbi::WireFormatLite::Int64SizePlusOne(this->_internal_end()); + } + + // int64 interval = 3; + if (this->_internal_interval() != 0) { + total_size += ::_pbi::WireFormatLite::Int64SizePlusOne(this->_internal_interval()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ScalarCalculate::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, + ScalarCalculate::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ScalarCalculate::GetClassData() const { return &_class_data_; } + + +void ScalarCalculate::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.ScalarCalculate) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _this->_impl_.tag_columns_.MergeFrom(from._impl_.tag_columns_); + if (!from._internal_time_index().empty()) { + _this->_internal_set_time_index(from._internal_time_index()); + } + if (!from._internal_field_column().empty()) { + _this->_internal_set_field_column(from._internal_field_column()); + } + if (from._internal_start() != 0) { + _this->_internal_set_start(from._internal_start()); + } + if (from._internal_end() != 0) { + _this->_internal_set_end(from._internal_end()); + } + if (from._internal_interval() != 0) { + _this->_internal_set_interval(from._internal_interval()); + } + _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void ScalarCalculate::CopyFrom(const ScalarCalculate& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:substrait_extension.ScalarCalculate) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ScalarCalculate::IsInitialized() const { + return true; +} + +void ScalarCalculate::InternalSwap(ScalarCalculate* 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_, lhs_arena, + &other->_impl_.time_index_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.field_column_, lhs_arena, + &other->_impl_.field_column_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(ScalarCalculate, _impl_.interval_) + + sizeof(ScalarCalculate::_impl_.interval_) + - PROTOBUF_FIELD_OFFSET(ScalarCalculate, _impl_.start_)>( + reinterpret_cast(&_impl_.start_), + reinterpret_cast(&other->_impl_.start_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata ScalarCalculate::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[5]); +} + // @@protoc_insertion_point(namespace_scope) } // namespace substrait_extension PROTOBUF_NAMESPACE_OPEN @@ -1627,6 +2039,10 @@ template<> PROTOBUF_NOINLINE ::substrait_extension::RangeManipulate* Arena::CreateMaybeMessage< ::substrait_extension::RangeManipulate >(Arena* arena) { return Arena::CreateMessageInternal< ::substrait_extension::RangeManipulate >(arena); } +template<> PROTOBUF_NOINLINE ::substrait_extension::ScalarCalculate* +Arena::CreateMaybeMessage< ::substrait_extension::ScalarCalculate >(Arena* arena) { + return Arena::CreateMessageInternal< ::substrait_extension::ScalarCalculate >(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 7ca32a1e..234028f2 100644 --- a/c++/substrait_extension/promql_plan.pb.h +++ b/c++/substrait_extension/promql_plan.pb.h @@ -54,6 +54,9 @@ extern InstantManipulateDefaultTypeInternal _InstantManipulate_default_instance_ class RangeManipulate; struct RangeManipulateDefaultTypeInternal; extern RangeManipulateDefaultTypeInternal _RangeManipulate_default_instance_; +class ScalarCalculate; +struct ScalarCalculateDefaultTypeInternal; +extern ScalarCalculateDefaultTypeInternal _ScalarCalculate_default_instance_; class SeriesDivide; struct SeriesDivideDefaultTypeInternal; extern SeriesDivideDefaultTypeInternal _SeriesDivide_default_instance_; @@ -65,6 +68,7 @@ PROTOBUF_NAMESPACE_OPEN template<> ::substrait_extension::EmptyMetric* Arena::CreateMaybeMessage<::substrait_extension::EmptyMetric>(Arena*); template<> ::substrait_extension::InstantManipulate* Arena::CreateMaybeMessage<::substrait_extension::InstantManipulate>(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*); PROTOBUF_NAMESPACE_CLOSE @@ -1014,6 +1018,234 @@ class RangeManipulate final : union { Impl_ _impl_; }; friend struct ::TableStruct_substrait_5fextension_2fpromql_5fplan_2eproto; }; +// ------------------------------------------------------------------- + +class ScalarCalculate final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:substrait_extension.ScalarCalculate) */ { + public: + inline ScalarCalculate() : ScalarCalculate(nullptr) {} + ~ScalarCalculate() override; + explicit PROTOBUF_CONSTEXPR ScalarCalculate(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ScalarCalculate(const ScalarCalculate& from); + ScalarCalculate(ScalarCalculate&& from) noexcept + : ScalarCalculate() { + *this = ::std::move(from); + } + + inline ScalarCalculate& operator=(const ScalarCalculate& from) { + CopyFrom(from); + return *this; + } + inline ScalarCalculate& operator=(ScalarCalculate&& 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 ScalarCalculate& default_instance() { + return *internal_default_instance(); + } + static inline const ScalarCalculate* internal_default_instance() { + return reinterpret_cast( + &_ScalarCalculate_default_instance_); + } + static constexpr int kIndexInFileMessages = + 5; + + friend void swap(ScalarCalculate& a, ScalarCalculate& b) { + a.Swap(&b); + } + inline void Swap(ScalarCalculate* 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(ScalarCalculate* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ScalarCalculate* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const ScalarCalculate& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const ScalarCalculate& from) { + ScalarCalculate::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(ScalarCalculate* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "substrait_extension.ScalarCalculate"; + } + protected: + explicit ScalarCalculate(::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 { + kTagColumnsFieldNumber = 6, + kTimeIndexFieldNumber = 5, + kFieldColumnFieldNumber = 7, + kStartFieldNumber = 1, + kEndFieldNumber = 2, + kIntervalFieldNumber = 3, + }; + // repeated string tag_columns = 6; + int tag_columns_size() const; + private: + int _internal_tag_columns_size() const; + public: + void clear_tag_columns(); + const std::string& tag_columns(int index) const; + std::string* mutable_tag_columns(int index); + void set_tag_columns(int index, const std::string& value); + void set_tag_columns(int index, std::string&& value); + void set_tag_columns(int index, const char* value); + void set_tag_columns(int index, const char* value, size_t size); + std::string* add_tag_columns(); + void add_tag_columns(const std::string& value); + void add_tag_columns(std::string&& value); + void add_tag_columns(const char* value); + void add_tag_columns(const char* value, size_t size); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& tag_columns() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_tag_columns(); + private: + const std::string& _internal_tag_columns(int index) const; + std::string* _internal_add_tag_columns(); + public: + + // string time_index = 5; + void clear_time_index(); + const std::string& time_index() const; + template + void set_time_index(ArgT0&& arg0, ArgT... args); + std::string* mutable_time_index(); + PROTOBUF_NODISCARD std::string* release_time_index(); + void set_allocated_time_index(std::string* time_index); + private: + const std::string& _internal_time_index() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_time_index(const std::string& value); + std::string* _internal_mutable_time_index(); + public: + + // string field_column = 7; + void clear_field_column(); + const std::string& field_column() const; + template + void set_field_column(ArgT0&& arg0, ArgT... args); + std::string* mutable_field_column(); + PROTOBUF_NODISCARD std::string* release_field_column(); + void set_allocated_field_column(std::string* field_column); + private: + const std::string& _internal_field_column() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_field_column(const std::string& value); + std::string* _internal_mutable_field_column(); + public: + + // int64 start = 1; + void clear_start(); + int64_t start() const; + void set_start(int64_t value); + private: + int64_t _internal_start() const; + void _internal_set_start(int64_t value); + public: + + // int64 end = 2; + void clear_end(); + int64_t end() const; + void set_end(int64_t value); + private: + int64_t _internal_end() const; + void _internal_set_end(int64_t value); + public: + + // int64 interval = 3; + void clear_interval(); + int64_t interval() const; + void set_interval(int64_t value); + private: + int64_t _internal_interval() const; + void _internal_set_interval(int64_t value); + public: + + // @@protoc_insertion_point(class_scope:substrait_extension.ScalarCalculate) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField tag_columns_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr time_index_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr field_column_; + int64_t start_; + int64_t end_; + int64_t interval_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_substrait_5fextension_2fpromql_5fplan_2eproto; +}; // =================================================================== @@ -1651,6 +1883,245 @@ RangeManipulate::mutable_tag_columns() { return &_impl_.tag_columns_; } +// ------------------------------------------------------------------- + +// ScalarCalculate + +// int64 start = 1; +inline void ScalarCalculate::clear_start() { + _impl_.start_ = int64_t{0}; +} +inline int64_t ScalarCalculate::_internal_start() const { + return _impl_.start_; +} +inline int64_t ScalarCalculate::start() const { + // @@protoc_insertion_point(field_get:substrait_extension.ScalarCalculate.start) + return _internal_start(); +} +inline void ScalarCalculate::_internal_set_start(int64_t value) { + + _impl_.start_ = value; +} +inline void ScalarCalculate::set_start(int64_t value) { + _internal_set_start(value); + // @@protoc_insertion_point(field_set:substrait_extension.ScalarCalculate.start) +} + +// int64 end = 2; +inline void ScalarCalculate::clear_end() { + _impl_.end_ = int64_t{0}; +} +inline int64_t ScalarCalculate::_internal_end() const { + return _impl_.end_; +} +inline int64_t ScalarCalculate::end() const { + // @@protoc_insertion_point(field_get:substrait_extension.ScalarCalculate.end) + return _internal_end(); +} +inline void ScalarCalculate::_internal_set_end(int64_t value) { + + _impl_.end_ = value; +} +inline void ScalarCalculate::set_end(int64_t value) { + _internal_set_end(value); + // @@protoc_insertion_point(field_set:substrait_extension.ScalarCalculate.end) +} + +// int64 interval = 3; +inline void ScalarCalculate::clear_interval() { + _impl_.interval_ = int64_t{0}; +} +inline int64_t ScalarCalculate::_internal_interval() const { + return _impl_.interval_; +} +inline int64_t ScalarCalculate::interval() const { + // @@protoc_insertion_point(field_get:substrait_extension.ScalarCalculate.interval) + return _internal_interval(); +} +inline void ScalarCalculate::_internal_set_interval(int64_t value) { + + _impl_.interval_ = value; +} +inline void ScalarCalculate::set_interval(int64_t value) { + _internal_set_interval(value); + // @@protoc_insertion_point(field_set:substrait_extension.ScalarCalculate.interval) +} + +// string time_index = 5; +inline void ScalarCalculate::clear_time_index() { + _impl_.time_index_.ClearToEmpty(); +} +inline const std::string& ScalarCalculate::time_index() const { + // @@protoc_insertion_point(field_get:substrait_extension.ScalarCalculate.time_index) + return _internal_time_index(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void ScalarCalculate::set_time_index(ArgT0&& arg0, ArgT... args) { + + _impl_.time_index_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:substrait_extension.ScalarCalculate.time_index) +} +inline std::string* ScalarCalculate::mutable_time_index() { + std::string* _s = _internal_mutable_time_index(); + // @@protoc_insertion_point(field_mutable:substrait_extension.ScalarCalculate.time_index) + return _s; +} +inline const std::string& ScalarCalculate::_internal_time_index() const { + return _impl_.time_index_.Get(); +} +inline void ScalarCalculate::_internal_set_time_index(const std::string& value) { + + _impl_.time_index_.Set(value, GetArenaForAllocation()); +} +inline std::string* ScalarCalculate::_internal_mutable_time_index() { + + return _impl_.time_index_.Mutable(GetArenaForAllocation()); +} +inline std::string* ScalarCalculate::release_time_index() { + // @@protoc_insertion_point(field_release:substrait_extension.ScalarCalculate.time_index) + return _impl_.time_index_.Release(); +} +inline void ScalarCalculate::set_allocated_time_index(std::string* time_index) { + if (time_index != nullptr) { + + } else { + + } + _impl_.time_index_.SetAllocated(time_index, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.time_index_.IsDefault()) { + _impl_.time_index_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:substrait_extension.ScalarCalculate.time_index) +} + +// repeated string tag_columns = 6; +inline int ScalarCalculate::_internal_tag_columns_size() const { + return _impl_.tag_columns_.size(); +} +inline int ScalarCalculate::tag_columns_size() const { + return _internal_tag_columns_size(); +} +inline void ScalarCalculate::clear_tag_columns() { + _impl_.tag_columns_.Clear(); +} +inline std::string* ScalarCalculate::add_tag_columns() { + std::string* _s = _internal_add_tag_columns(); + // @@protoc_insertion_point(field_add_mutable:substrait_extension.ScalarCalculate.tag_columns) + return _s; +} +inline const std::string& ScalarCalculate::_internal_tag_columns(int index) const { + return _impl_.tag_columns_.Get(index); +} +inline const std::string& ScalarCalculate::tag_columns(int index) const { + // @@protoc_insertion_point(field_get:substrait_extension.ScalarCalculate.tag_columns) + return _internal_tag_columns(index); +} +inline std::string* ScalarCalculate::mutable_tag_columns(int index) { + // @@protoc_insertion_point(field_mutable:substrait_extension.ScalarCalculate.tag_columns) + return _impl_.tag_columns_.Mutable(index); +} +inline void ScalarCalculate::set_tag_columns(int index, const std::string& value) { + _impl_.tag_columns_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set:substrait_extension.ScalarCalculate.tag_columns) +} +inline void ScalarCalculate::set_tag_columns(int index, std::string&& value) { + _impl_.tag_columns_.Mutable(index)->assign(std::move(value)); + // @@protoc_insertion_point(field_set:substrait_extension.ScalarCalculate.tag_columns) +} +inline void ScalarCalculate::set_tag_columns(int index, const char* value) { + GOOGLE_DCHECK(value != nullptr); + _impl_.tag_columns_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:substrait_extension.ScalarCalculate.tag_columns) +} +inline void ScalarCalculate::set_tag_columns(int index, const char* value, size_t size) { + _impl_.tag_columns_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:substrait_extension.ScalarCalculate.tag_columns) +} +inline std::string* ScalarCalculate::_internal_add_tag_columns() { + return _impl_.tag_columns_.Add(); +} +inline void ScalarCalculate::add_tag_columns(const std::string& value) { + _impl_.tag_columns_.Add()->assign(value); + // @@protoc_insertion_point(field_add:substrait_extension.ScalarCalculate.tag_columns) +} +inline void ScalarCalculate::add_tag_columns(std::string&& value) { + _impl_.tag_columns_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:substrait_extension.ScalarCalculate.tag_columns) +} +inline void ScalarCalculate::add_tag_columns(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _impl_.tag_columns_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:substrait_extension.ScalarCalculate.tag_columns) +} +inline void ScalarCalculate::add_tag_columns(const char* value, size_t size) { + _impl_.tag_columns_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:substrait_extension.ScalarCalculate.tag_columns) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& +ScalarCalculate::tag_columns() const { + // @@protoc_insertion_point(field_list:substrait_extension.ScalarCalculate.tag_columns) + return _impl_.tag_columns_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* +ScalarCalculate::mutable_tag_columns() { + // @@protoc_insertion_point(field_mutable_list:substrait_extension.ScalarCalculate.tag_columns) + return &_impl_.tag_columns_; +} + +// string field_column = 7; +inline void ScalarCalculate::clear_field_column() { + _impl_.field_column_.ClearToEmpty(); +} +inline const std::string& ScalarCalculate::field_column() const { + // @@protoc_insertion_point(field_get:substrait_extension.ScalarCalculate.field_column) + return _internal_field_column(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void ScalarCalculate::set_field_column(ArgT0&& arg0, ArgT... args) { + + _impl_.field_column_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:substrait_extension.ScalarCalculate.field_column) +} +inline std::string* ScalarCalculate::mutable_field_column() { + std::string* _s = _internal_mutable_field_column(); + // @@protoc_insertion_point(field_mutable:substrait_extension.ScalarCalculate.field_column) + return _s; +} +inline const std::string& ScalarCalculate::_internal_field_column() const { + return _impl_.field_column_.Get(); +} +inline void ScalarCalculate::_internal_set_field_column(const std::string& value) { + + _impl_.field_column_.Set(value, GetArenaForAllocation()); +} +inline std::string* ScalarCalculate::_internal_mutable_field_column() { + + return _impl_.field_column_.Mutable(GetArenaForAllocation()); +} +inline std::string* ScalarCalculate::release_field_column() { + // @@protoc_insertion_point(field_release:substrait_extension.ScalarCalculate.field_column) + return _impl_.field_column_.Release(); +} +inline void ScalarCalculate::set_allocated_field_column(std::string* field_column) { + if (field_column != nullptr) { + + } else { + + } + _impl_.field_column_.SetAllocated(field_column, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.field_column_.IsDefault()) { + _impl_.field_column_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:substrait_extension.ScalarCalculate.field_column) +} + #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ @@ -1662,6 +2133,8 @@ RangeManipulate::mutable_tag_columns() { // ------------------------------------------------------------------- +// ------------------------------------------------------------------- + // @@protoc_insertion_point(namespace_scope) diff --git a/go/substrait_extension/promql_plan.pb.go b/go/substrait_extension/promql_plan.pb.go index 8a673d0e..0533ef2e 100644 --- a/go/substrait_extension/promql_plan.pb.go +++ b/go/substrait_extension/promql_plan.pb.go @@ -400,6 +400,99 @@ func (x *RangeManipulate) GetTagColumns() []string { return nil } +type ScalarCalculate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Start timestamp in millisecond + Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` + // End timestamp in millisecond + End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` + // Interval in millisecond + Interval int64 `protobuf:"varint,3,opt,name=interval,proto3" json:"interval,omitempty"` + // Column name of time index column + TimeIndex string `protobuf:"bytes,5,opt,name=time_index,json=timeIndex,proto3" json:"time_index,omitempty"` + // Names of tag columns + TagColumns []string `protobuf:"bytes,6,rep,name=tag_columns,json=tagColumns,proto3" json:"tag_columns,omitempty"` + // Column name of field column + FieldColumn string `protobuf:"bytes,7,opt,name=field_column,json=fieldColumn,proto3" json:"field_column,omitempty"` +} + +func (x *ScalarCalculate) Reset() { + *x = ScalarCalculate{} + if protoimpl.UnsafeEnabled { + mi := &file_substrait_extension_promql_plan_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ScalarCalculate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScalarCalculate) ProtoMessage() {} + +func (x *ScalarCalculate) ProtoReflect() protoreflect.Message { + mi := &file_substrait_extension_promql_plan_proto_msgTypes[5] + 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 ScalarCalculate.ProtoReflect.Descriptor instead. +func (*ScalarCalculate) Descriptor() ([]byte, []int) { + return file_substrait_extension_promql_plan_proto_rawDescGZIP(), []int{5} +} + +func (x *ScalarCalculate) GetStart() int64 { + if x != nil { + return x.Start + } + return 0 +} + +func (x *ScalarCalculate) GetEnd() int64 { + if x != nil { + return x.End + } + return 0 +} + +func (x *ScalarCalculate) GetInterval() int64 { + if x != nil { + return x.Interval + } + return 0 +} + +func (x *ScalarCalculate) GetTimeIndex() string { + if x != nil { + return x.TimeIndex + } + return "" +} + +func (x *ScalarCalculate) GetTagColumns() []string { + if x != nil { + return x.TagColumns + } + return nil +} + +func (x *ScalarCalculate) GetFieldColumn() string { + if x != nil { + return x.FieldColumn + } + return "" +} + var File_substrait_extension_promql_plan_proto protoreflect.FileDescriptor var file_substrait_extension_promql_plan_proto_rawDesc = []byte{ @@ -444,12 +537,23 @@ var file_substrait_extension_promql_plan_proto_rawDesc = []byte{ 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, 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, + 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 ( @@ -464,13 +568,14 @@ 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, 5) +var file_substrait_extension_promql_plan_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_substrait_extension_promql_plan_proto_goTypes = []interface{}{ (*EmptyMetric)(nil), // 0: substrait_extension.EmptyMetric (*InstantManipulate)(nil), // 1: substrait_extension.InstantManipulate (*SeriesNormalize)(nil), // 2: substrait_extension.SeriesNormalize (*SeriesDivide)(nil), // 3: substrait_extension.SeriesDivide (*RangeManipulate)(nil), // 4: substrait_extension.RangeManipulate + (*ScalarCalculate)(nil), // 5: substrait_extension.ScalarCalculate } var file_substrait_extension_promql_plan_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type @@ -546,6 +651,18 @@ func file_substrait_extension_promql_plan_proto_init() { return nil } } + file_substrait_extension_promql_plan_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ScalarCalculate); 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{ @@ -553,7 +670,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: 5, + NumMessages: 6, 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 4651068c..aff93eee 100644 --- a/java/src/main/java/substrait_extension/PromqlPlan.java +++ b/java/src/main/java/substrait_extension/PromqlPlan.java @@ -4617,6 +4617,1359 @@ public substrait_extension.PromqlPlan.RangeManipulate getDefaultInstanceForType( } + public interface ScalarCalculateOrBuilder extends + // @@protoc_insertion_point(interface_extends:substrait_extension.ScalarCalculate) + com.google.protobuf.MessageOrBuilder { + + /** + *
+     * Start timestamp in millisecond
+     * 
+ * + * int64 start = 1; + * @return The start. + */ + long getStart(); + + /** + *
+     * End timestamp in millisecond
+     * 
+ * + * int64 end = 2; + * @return The end. + */ + long getEnd(); + + /** + *
+     * Interval in millisecond
+     * 
+ * + * int64 interval = 3; + * @return The interval. + */ + long getInterval(); + + /** + *
+     * Column name of time index column
+     * 
+ * + * string time_index = 5; + * @return The timeIndex. + */ + java.lang.String getTimeIndex(); + /** + *
+     * Column name of time index column
+     * 
+ * + * string time_index = 5; + * @return The bytes for timeIndex. + */ + com.google.protobuf.ByteString + getTimeIndexBytes(); + + /** + *
+     * Names of tag columns
+     * 
+ * + * repeated string tag_columns = 6; + * @return A list containing the tagColumns. + */ + java.util.List + getTagColumnsList(); + /** + *
+     * Names of tag columns
+     * 
+ * + * repeated string tag_columns = 6; + * @return The count of tagColumns. + */ + int getTagColumnsCount(); + /** + *
+     * Names of tag columns
+     * 
+ * + * repeated string tag_columns = 6; + * @param index The index of the element to return. + * @return The tagColumns at the given index. + */ + java.lang.String getTagColumns(int index); + /** + *
+     * Names of tag columns
+     * 
+ * + * repeated string tag_columns = 6; + * @param index The index of the value to return. + * @return The bytes of the tagColumns at the given index. + */ + com.google.protobuf.ByteString + getTagColumnsBytes(int index); + + /** + *
+     * Column name of field column
+     * 
+ * + * string field_column = 7; + * @return The fieldColumn. + */ + java.lang.String getFieldColumn(); + /** + *
+     * Column name of field column
+     * 
+ * + * string field_column = 7; + * @return The bytes for fieldColumn. + */ + com.google.protobuf.ByteString + getFieldColumnBytes(); + } + /** + * Protobuf type {@code substrait_extension.ScalarCalculate} + */ + public static final class ScalarCalculate extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:substrait_extension.ScalarCalculate) + ScalarCalculateOrBuilder { + private static final long serialVersionUID = 0L; + // Use ScalarCalculate.newBuilder() to construct. + private ScalarCalculate(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ScalarCalculate() { + timeIndex_ = ""; + tagColumns_ = com.google.protobuf.LazyStringArrayList.EMPTY; + fieldColumn_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new ScalarCalculate(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ScalarCalculate( + 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: { + + start_ = input.readInt64(); + break; + } + case 16: { + + end_ = input.readInt64(); + break; + } + case 24: { + + interval_ = input.readInt64(); + break; + } + case 42: { + java.lang.String s = input.readStringRequireUtf8(); + + timeIndex_ = s; + break; + } + case 50: { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + tagColumns_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + tagColumns_.add(s); + break; + } + case 58: { + java.lang.String s = input.readStringRequireUtf8(); + + fieldColumn_ = s; + 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)) { + tagColumns_ = tagColumns_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return substrait_extension.PromqlPlan.internal_static_substrait_extension_ScalarCalculate_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return substrait_extension.PromqlPlan.internal_static_substrait_extension_ScalarCalculate_fieldAccessorTable + .ensureFieldAccessorsInitialized( + substrait_extension.PromqlPlan.ScalarCalculate.class, substrait_extension.PromqlPlan.ScalarCalculate.Builder.class); + } + + public static final int START_FIELD_NUMBER = 1; + private long start_; + /** + *
+     * Start timestamp in millisecond
+     * 
+ * + * int64 start = 1; + * @return The start. + */ + @java.lang.Override + public long getStart() { + return start_; + } + + public static final int END_FIELD_NUMBER = 2; + private long end_; + /** + *
+     * End timestamp in millisecond
+     * 
+ * + * int64 end = 2; + * @return The end. + */ + @java.lang.Override + public long getEnd() { + return end_; + } + + public static final int INTERVAL_FIELD_NUMBER = 3; + private long interval_; + /** + *
+     * Interval in millisecond
+     * 
+ * + * int64 interval = 3; + * @return The interval. + */ + @java.lang.Override + public long getInterval() { + return interval_; + } + + public static final int TIME_INDEX_FIELD_NUMBER = 5; + private volatile java.lang.Object timeIndex_; + /** + *
+     * Column name of time index column
+     * 
+ * + * string time_index = 5; + * @return The timeIndex. + */ + @java.lang.Override + public java.lang.String getTimeIndex() { + java.lang.Object ref = timeIndex_; + 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(); + timeIndex_ = s; + return s; + } + } + /** + *
+     * Column name of time index column
+     * 
+ * + * string time_index = 5; + * @return The bytes for timeIndex. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTimeIndexBytes() { + java.lang.Object ref = timeIndex_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + timeIndex_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TAG_COLUMNS_FIELD_NUMBER = 6; + private com.google.protobuf.LazyStringList tagColumns_; + /** + *
+     * Names of tag columns
+     * 
+ * + * repeated string tag_columns = 6; + * @return A list containing the tagColumns. + */ + public com.google.protobuf.ProtocolStringList + getTagColumnsList() { + return tagColumns_; + } + /** + *
+     * Names of tag columns
+     * 
+ * + * repeated string tag_columns = 6; + * @return The count of tagColumns. + */ + public int getTagColumnsCount() { + return tagColumns_.size(); + } + /** + *
+     * Names of tag columns
+     * 
+ * + * repeated string tag_columns = 6; + * @param index The index of the element to return. + * @return The tagColumns at the given index. + */ + public java.lang.String getTagColumns(int index) { + return tagColumns_.get(index); + } + /** + *
+     * Names of tag columns
+     * 
+ * + * repeated string tag_columns = 6; + * @param index The index of the value to return. + * @return The bytes of the tagColumns at the given index. + */ + public com.google.protobuf.ByteString + getTagColumnsBytes(int index) { + return tagColumns_.getByteString(index); + } + + public static final int FIELD_COLUMN_FIELD_NUMBER = 7; + private volatile java.lang.Object fieldColumn_; + /** + *
+     * Column name of field column
+     * 
+ * + * string field_column = 7; + * @return The fieldColumn. + */ + @java.lang.Override + public java.lang.String getFieldColumn() { + java.lang.Object ref = fieldColumn_; + 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(); + fieldColumn_ = s; + return s; + } + } + /** + *
+     * Column name of field column
+     * 
+ * + * string field_column = 7; + * @return The bytes for fieldColumn. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getFieldColumnBytes() { + java.lang.Object ref = fieldColumn_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + fieldColumn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + 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 (start_ != 0L) { + output.writeInt64(1, start_); + } + if (end_ != 0L) { + output.writeInt64(2, end_); + } + if (interval_ != 0L) { + output.writeInt64(3, interval_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(timeIndex_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, timeIndex_); + } + for (int i = 0; i < tagColumns_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 6, tagColumns_.getRaw(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(fieldColumn_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, fieldColumn_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (start_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(1, start_); + } + if (end_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(2, end_); + } + if (interval_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(3, interval_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(timeIndex_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, timeIndex_); + } + { + int dataSize = 0; + for (int i = 0; i < tagColumns_.size(); i++) { + dataSize += computeStringSizeNoTag(tagColumns_.getRaw(i)); + } + size += dataSize; + size += 1 * getTagColumnsList().size(); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(fieldColumn_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, fieldColumn_); + } + 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.ScalarCalculate)) { + return super.equals(obj); + } + substrait_extension.PromqlPlan.ScalarCalculate other = (substrait_extension.PromqlPlan.ScalarCalculate) obj; + + if (getStart() + != other.getStart()) return false; + if (getEnd() + != other.getEnd()) return false; + if (getInterval() + != other.getInterval()) return false; + if (!getTimeIndex() + .equals(other.getTimeIndex())) return false; + if (!getTagColumnsList() + .equals(other.getTagColumnsList())) return false; + if (!getFieldColumn() + .equals(other.getFieldColumn())) 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) + START_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getStart()); + hash = (37 * hash) + END_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getEnd()); + hash = (37 * hash) + INTERVAL_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getInterval()); + hash = (37 * hash) + TIME_INDEX_FIELD_NUMBER; + hash = (53 * hash) + getTimeIndex().hashCode(); + if (getTagColumnsCount() > 0) { + hash = (37 * hash) + TAG_COLUMNS_FIELD_NUMBER; + hash = (53 * hash) + getTagColumnsList().hashCode(); + } + hash = (37 * hash) + FIELD_COLUMN_FIELD_NUMBER; + hash = (53 * hash) + getFieldColumn().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static substrait_extension.PromqlPlan.ScalarCalculate parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static substrait_extension.PromqlPlan.ScalarCalculate 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.ScalarCalculate parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static substrait_extension.PromqlPlan.ScalarCalculate 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.ScalarCalculate parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static substrait_extension.PromqlPlan.ScalarCalculate parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static substrait_extension.PromqlPlan.ScalarCalculate parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static substrait_extension.PromqlPlan.ScalarCalculate 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.ScalarCalculate parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static substrait_extension.PromqlPlan.ScalarCalculate 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.ScalarCalculate parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static substrait_extension.PromqlPlan.ScalarCalculate 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.ScalarCalculate 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.ScalarCalculate} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:substrait_extension.ScalarCalculate) + substrait_extension.PromqlPlan.ScalarCalculateOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return substrait_extension.PromqlPlan.internal_static_substrait_extension_ScalarCalculate_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return substrait_extension.PromqlPlan.internal_static_substrait_extension_ScalarCalculate_fieldAccessorTable + .ensureFieldAccessorsInitialized( + substrait_extension.PromqlPlan.ScalarCalculate.class, substrait_extension.PromqlPlan.ScalarCalculate.Builder.class); + } + + // Construct using substrait_extension.PromqlPlan.ScalarCalculate.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(); + start_ = 0L; + + end_ = 0L; + + interval_ = 0L; + + timeIndex_ = ""; + + tagColumns_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + fieldColumn_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return substrait_extension.PromqlPlan.internal_static_substrait_extension_ScalarCalculate_descriptor; + } + + @java.lang.Override + public substrait_extension.PromqlPlan.ScalarCalculate getDefaultInstanceForType() { + return substrait_extension.PromqlPlan.ScalarCalculate.getDefaultInstance(); + } + + @java.lang.Override + public substrait_extension.PromqlPlan.ScalarCalculate build() { + substrait_extension.PromqlPlan.ScalarCalculate result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public substrait_extension.PromqlPlan.ScalarCalculate buildPartial() { + substrait_extension.PromqlPlan.ScalarCalculate result = new substrait_extension.PromqlPlan.ScalarCalculate(this); + int from_bitField0_ = bitField0_; + result.start_ = start_; + result.end_ = end_; + result.interval_ = interval_; + result.timeIndex_ = timeIndex_; + if (((bitField0_ & 0x00000001) != 0)) { + tagColumns_ = tagColumns_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.tagColumns_ = tagColumns_; + result.fieldColumn_ = fieldColumn_; + 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.ScalarCalculate) { + return mergeFrom((substrait_extension.PromqlPlan.ScalarCalculate)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(substrait_extension.PromqlPlan.ScalarCalculate other) { + if (other == substrait_extension.PromqlPlan.ScalarCalculate.getDefaultInstance()) return this; + if (other.getStart() != 0L) { + setStart(other.getStart()); + } + if (other.getEnd() != 0L) { + setEnd(other.getEnd()); + } + if (other.getInterval() != 0L) { + setInterval(other.getInterval()); + } + if (!other.getTimeIndex().isEmpty()) { + timeIndex_ = other.timeIndex_; + onChanged(); + } + if (!other.tagColumns_.isEmpty()) { + if (tagColumns_.isEmpty()) { + tagColumns_ = other.tagColumns_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureTagColumnsIsMutable(); + tagColumns_.addAll(other.tagColumns_); + } + onChanged(); + } + if (!other.getFieldColumn().isEmpty()) { + fieldColumn_ = other.fieldColumn_; + onChanged(); + } + 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.ScalarCalculate parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (substrait_extension.PromqlPlan.ScalarCalculate) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private long start_ ; + /** + *
+       * Start timestamp in millisecond
+       * 
+ * + * int64 start = 1; + * @return The start. + */ + @java.lang.Override + public long getStart() { + return start_; + } + /** + *
+       * Start timestamp in millisecond
+       * 
+ * + * int64 start = 1; + * @param value The start to set. + * @return This builder for chaining. + */ + public Builder setStart(long value) { + + start_ = value; + onChanged(); + return this; + } + /** + *
+       * Start timestamp in millisecond
+       * 
+ * + * int64 start = 1; + * @return This builder for chaining. + */ + public Builder clearStart() { + + start_ = 0L; + onChanged(); + return this; + } + + private long end_ ; + /** + *
+       * End timestamp in millisecond
+       * 
+ * + * int64 end = 2; + * @return The end. + */ + @java.lang.Override + public long getEnd() { + return end_; + } + /** + *
+       * End timestamp in millisecond
+       * 
+ * + * int64 end = 2; + * @param value The end to set. + * @return This builder for chaining. + */ + public Builder setEnd(long value) { + + end_ = value; + onChanged(); + return this; + } + /** + *
+       * End timestamp in millisecond
+       * 
+ * + * int64 end = 2; + * @return This builder for chaining. + */ + public Builder clearEnd() { + + end_ = 0L; + onChanged(); + return this; + } + + private long interval_ ; + /** + *
+       * Interval in millisecond
+       * 
+ * + * int64 interval = 3; + * @return The interval. + */ + @java.lang.Override + public long getInterval() { + return interval_; + } + /** + *
+       * Interval in millisecond
+       * 
+ * + * int64 interval = 3; + * @param value The interval to set. + * @return This builder for chaining. + */ + public Builder setInterval(long value) { + + interval_ = value; + onChanged(); + return this; + } + /** + *
+       * Interval in millisecond
+       * 
+ * + * int64 interval = 3; + * @return This builder for chaining. + */ + public Builder clearInterval() { + + interval_ = 0L; + onChanged(); + return this; + } + + private java.lang.Object timeIndex_ = ""; + /** + *
+       * Column name of time index column
+       * 
+ * + * string time_index = 5; + * @return The timeIndex. + */ + public java.lang.String getTimeIndex() { + java.lang.Object ref = timeIndex_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + timeIndex_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+       * Column name of time index column
+       * 
+ * + * string time_index = 5; + * @return The bytes for timeIndex. + */ + public com.google.protobuf.ByteString + getTimeIndexBytes() { + java.lang.Object ref = timeIndex_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + timeIndex_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+       * Column name of time index column
+       * 
+ * + * string time_index = 5; + * @param value The timeIndex to set. + * @return This builder for chaining. + */ + public Builder setTimeIndex( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + timeIndex_ = value; + onChanged(); + return this; + } + /** + *
+       * Column name of time index column
+       * 
+ * + * string time_index = 5; + * @return This builder for chaining. + */ + public Builder clearTimeIndex() { + + timeIndex_ = getDefaultInstance().getTimeIndex(); + onChanged(); + return this; + } + /** + *
+       * Column name of time index column
+       * 
+ * + * string time_index = 5; + * @param value The bytes for timeIndex to set. + * @return This builder for chaining. + */ + public Builder setTimeIndexBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + timeIndex_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList tagColumns_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureTagColumnsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + tagColumns_ = new com.google.protobuf.LazyStringArrayList(tagColumns_); + bitField0_ |= 0x00000001; + } + } + /** + *
+       * Names of tag columns
+       * 
+ * + * repeated string tag_columns = 6; + * @return A list containing the tagColumns. + */ + public com.google.protobuf.ProtocolStringList + getTagColumnsList() { + return tagColumns_.getUnmodifiableView(); + } + /** + *
+       * Names of tag columns
+       * 
+ * + * repeated string tag_columns = 6; + * @return The count of tagColumns. + */ + public int getTagColumnsCount() { + return tagColumns_.size(); + } + /** + *
+       * Names of tag columns
+       * 
+ * + * repeated string tag_columns = 6; + * @param index The index of the element to return. + * @return The tagColumns at the given index. + */ + public java.lang.String getTagColumns(int index) { + return tagColumns_.get(index); + } + /** + *
+       * Names of tag columns
+       * 
+ * + * repeated string tag_columns = 6; + * @param index The index of the value to return. + * @return The bytes of the tagColumns at the given index. + */ + public com.google.protobuf.ByteString + getTagColumnsBytes(int index) { + return tagColumns_.getByteString(index); + } + /** + *
+       * Names of tag columns
+       * 
+ * + * repeated string tag_columns = 6; + * @param index The index to set the value at. + * @param value The tagColumns to set. + * @return This builder for chaining. + */ + public Builder setTagColumns( + int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTagColumnsIsMutable(); + tagColumns_.set(index, value); + onChanged(); + return this; + } + /** + *
+       * Names of tag columns
+       * 
+ * + * repeated string tag_columns = 6; + * @param value The tagColumns to add. + * @return This builder for chaining. + */ + public Builder addTagColumns( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTagColumnsIsMutable(); + tagColumns_.add(value); + onChanged(); + return this; + } + /** + *
+       * Names of tag columns
+       * 
+ * + * repeated string tag_columns = 6; + * @param values The tagColumns to add. + * @return This builder for chaining. + */ + public Builder addAllTagColumns( + java.lang.Iterable values) { + ensureTagColumnsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, tagColumns_); + onChanged(); + return this; + } + /** + *
+       * Names of tag columns
+       * 
+ * + * repeated string tag_columns = 6; + * @return This builder for chaining. + */ + public Builder clearTagColumns() { + tagColumns_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+       * Names of tag columns
+       * 
+ * + * repeated string tag_columns = 6; + * @param value The bytes of the tagColumns to add. + * @return This builder for chaining. + */ + public Builder addTagColumnsBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureTagColumnsIsMutable(); + tagColumns_.add(value); + onChanged(); + return this; + } + + private java.lang.Object fieldColumn_ = ""; + /** + *
+       * Column name of field column
+       * 
+ * + * string field_column = 7; + * @return The fieldColumn. + */ + public java.lang.String getFieldColumn() { + java.lang.Object ref = fieldColumn_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + fieldColumn_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+       * Column name of field column
+       * 
+ * + * string field_column = 7; + * @return The bytes for fieldColumn. + */ + public com.google.protobuf.ByteString + getFieldColumnBytes() { + java.lang.Object ref = fieldColumn_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + fieldColumn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+       * Column name of field column
+       * 
+ * + * string field_column = 7; + * @param value The fieldColumn to set. + * @return This builder for chaining. + */ + public Builder setFieldColumn( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + fieldColumn_ = value; + onChanged(); + return this; + } + /** + *
+       * Column name of field column
+       * 
+ * + * string field_column = 7; + * @return This builder for chaining. + */ + public Builder clearFieldColumn() { + + fieldColumn_ = getDefaultInstance().getFieldColumn(); + onChanged(); + return this; + } + /** + *
+       * Column name of field column
+       * 
+ * + * string field_column = 7; + * @param value The bytes for fieldColumn to set. + * @return This builder for chaining. + */ + public Builder setFieldColumnBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + fieldColumn_ = value; + 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.ScalarCalculate) + } + + // @@protoc_insertion_point(class_scope:substrait_extension.ScalarCalculate) + private static final substrait_extension.PromqlPlan.ScalarCalculate DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new substrait_extension.PromqlPlan.ScalarCalculate(); + } + + public static substrait_extension.PromqlPlan.ScalarCalculate getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ScalarCalculate parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ScalarCalculate(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.ScalarCalculate getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + private static final com.google.protobuf.Descriptors.Descriptor internal_static_substrait_extension_EmptyMetric_descriptor; private static final @@ -4642,6 +5995,11 @@ public substrait_extension.PromqlPlan.RangeManipulate getDefaultInstanceForType( private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_substrait_extension_RangeManipulate_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_substrait_extension_ScalarCalculate_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_substrait_extension_ScalarCalculate_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -4663,8 +6021,12 @@ public substrait_extension.PromqlPlan.RangeManipulate getDefaultInstanceForType( "\030\001 \003(\t\"w\n\017RangeManipulate\022\r\n\005start\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\013tag_column" + - "s\030\006 \003(\tB?Z=github.com/GreptimeTeam/grept" + - "ime-proto/go/substrait_extensionb\006proto3" + "s\030\006 \003(\t\"~\n\017ScalarCalculate\022\r\n\005start\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\014fie" + + "ld_column\030\007 \001(\tB?Z=github.com/GreptimeTe" + + "am/greptime-proto/go/substrait_extension" + + "b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -4700,6 +6062,12 @@ public substrait_extension.PromqlPlan.RangeManipulate getDefaultInstanceForType( com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_substrait_extension_RangeManipulate_descriptor, new java.lang.String[] { "Start", "End", "Interval", "Range", "TimeIndex", "TagColumns", }); + internal_static_substrait_extension_ScalarCalculate_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_substrait_extension_ScalarCalculate_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_substrait_extension_ScalarCalculate_descriptor, + new java.lang.String[] { "Start", "End", "Interval", "TimeIndex", "TagColumns", "FieldColumn", }); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto/substrait_extension/promql_plan.proto b/proto/substrait_extension/promql_plan.proto index 7e62f2c4..7143d81a 100644 --- a/proto/substrait_extension/promql_plan.proto +++ b/proto/substrait_extension/promql_plan.proto @@ -70,3 +70,18 @@ message RangeManipulate { // Names of tag columns repeated string tag_columns = 6; } + +message ScalarCalculate { + // Start timestamp in millisecond + int64 start = 1; + // End timestamp in millisecond + int64 end = 2; + // Interval in millisecond + int64 interval = 3; + // Column name of time index column + string time_index = 5; + // Names of tag columns + repeated string tag_columns = 6; + // Column name of field column + string field_column = 7; +}