feat: PromQL ScalarCalculate plan (#147)

This commit is contained in:
WU Jingdi
2024-04-17 11:25:37 +08:00
committed by GitHub
parent 04d78b6e02
commit e04700efd3
5 changed files with 2404 additions and 15 deletions
+125 -8
View File
@@ -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,
},