feat: add promql query support (#13)

* feat: add promql query support

* feat: add go sources

* refactor: rename promql to prom_range_query

* fix: lint issue
This commit is contained in:
Ning Sun
2023-03-13 11:34:53 +08:00
committed by GitHub
parent ad01872950
commit 3a71515056
3 changed files with 176 additions and 58 deletions
+167 -57
View File
@@ -381,6 +381,7 @@ type QueryRequest struct {
// //
// *QueryRequest_Sql // *QueryRequest_Sql
// *QueryRequest_LogicalPlan // *QueryRequest_LogicalPlan
// *QueryRequest_PromRangeQuery
Query isQueryRequest_Query `protobuf_oneof:"query"` Query isQueryRequest_Query `protobuf_oneof:"query"`
} }
@@ -437,6 +438,13 @@ func (x *QueryRequest) GetLogicalPlan() []byte {
return nil return nil
} }
func (x *QueryRequest) GetPromRangeQuery() *PromRangeQuery {
if x, ok := x.GetQuery().(*QueryRequest_PromRangeQuery); ok {
return x.PromRangeQuery
}
return nil
}
type isQueryRequest_Query interface { type isQueryRequest_Query interface {
isQueryRequest_Query() isQueryRequest_Query()
} }
@@ -449,10 +457,87 @@ type QueryRequest_LogicalPlan struct {
LogicalPlan []byte `protobuf:"bytes,2,opt,name=logical_plan,json=logicalPlan,proto3,oneof"` LogicalPlan []byte `protobuf:"bytes,2,opt,name=logical_plan,json=logicalPlan,proto3,oneof"`
} }
type QueryRequest_PromRangeQuery struct {
PromRangeQuery *PromRangeQuery `protobuf:"bytes,3,opt,name=prom_range_query,json=promRangeQuery,proto3,oneof"`
}
func (*QueryRequest_Sql) isQueryRequest_Query() {} func (*QueryRequest_Sql) isQueryRequest_Query() {}
func (*QueryRequest_LogicalPlan) isQueryRequest_Query() {} func (*QueryRequest_LogicalPlan) isQueryRequest_Query() {}
func (*QueryRequest_PromRangeQuery) isQueryRequest_Query() {}
type PromRangeQuery struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
Start string `protobuf:"bytes,2,opt,name=start,proto3" json:"start,omitempty"`
End string `protobuf:"bytes,3,opt,name=end,proto3" json:"end,omitempty"`
Step string `protobuf:"bytes,4,opt,name=step,proto3" json:"step,omitempty"`
}
func (x *PromRangeQuery) Reset() {
*x = PromRangeQuery{}
if protoimpl.UnsafeEnabled {
mi := &file_greptime_v1_database_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PromRangeQuery) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PromRangeQuery) ProtoMessage() {}
func (x *PromRangeQuery) ProtoReflect() protoreflect.Message {
mi := &file_greptime_v1_database_proto_msgTypes[6]
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 PromRangeQuery.ProtoReflect.Descriptor instead.
func (*PromRangeQuery) Descriptor() ([]byte, []int) {
return file_greptime_v1_database_proto_rawDescGZIP(), []int{6}
}
func (x *PromRangeQuery) GetQuery() string {
if x != nil {
return x.Query
}
return ""
}
func (x *PromRangeQuery) GetStart() string {
if x != nil {
return x.Start
}
return ""
}
func (x *PromRangeQuery) GetEnd() string {
if x != nil {
return x.End
}
return ""
}
func (x *PromRangeQuery) GetStep() string {
if x != nil {
return x.Step
}
return ""
}
type InsertRequest struct { type InsertRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@@ -472,7 +557,7 @@ type InsertRequest struct {
func (x *InsertRequest) Reset() { func (x *InsertRequest) Reset() {
*x = InsertRequest{} *x = InsertRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_greptime_v1_database_proto_msgTypes[6] mi := &file_greptime_v1_database_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -485,7 +570,7 @@ func (x *InsertRequest) String() string {
func (*InsertRequest) ProtoMessage() {} func (*InsertRequest) ProtoMessage() {}
func (x *InsertRequest) ProtoReflect() protoreflect.Message { func (x *InsertRequest) ProtoReflect() protoreflect.Message {
mi := &file_greptime_v1_database_proto_msgTypes[6] mi := &file_greptime_v1_database_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -498,7 +583,7 @@ func (x *InsertRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use InsertRequest.ProtoReflect.Descriptor instead. // Deprecated: Use InsertRequest.ProtoReflect.Descriptor instead.
func (*InsertRequest) Descriptor() ([]byte, []int) { func (*InsertRequest) Descriptor() ([]byte, []int) {
return file_greptime_v1_database_proto_rawDescGZIP(), []int{6} return file_greptime_v1_database_proto_rawDescGZIP(), []int{7}
} }
func (x *InsertRequest) GetTableName() string { func (x *InsertRequest) GetTableName() string {
@@ -540,7 +625,7 @@ type AffectedRows struct {
func (x *AffectedRows) Reset() { func (x *AffectedRows) Reset() {
*x = AffectedRows{} *x = AffectedRows{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_greptime_v1_database_proto_msgTypes[7] mi := &file_greptime_v1_database_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -553,7 +638,7 @@ func (x *AffectedRows) String() string {
func (*AffectedRows) ProtoMessage() {} func (*AffectedRows) ProtoMessage() {}
func (x *AffectedRows) ProtoReflect() protoreflect.Message { func (x *AffectedRows) ProtoReflect() protoreflect.Message {
mi := &file_greptime_v1_database_proto_msgTypes[7] mi := &file_greptime_v1_database_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -566,7 +651,7 @@ func (x *AffectedRows) ProtoReflect() protoreflect.Message {
// Deprecated: Use AffectedRows.ProtoReflect.Descriptor instead. // Deprecated: Use AffectedRows.ProtoReflect.Descriptor instead.
func (*AffectedRows) Descriptor() ([]byte, []int) { func (*AffectedRows) Descriptor() ([]byte, []int) {
return file_greptime_v1_database_proto_rawDescGZIP(), []int{7} return file_greptime_v1_database_proto_rawDescGZIP(), []int{8}
} }
func (x *AffectedRows) GetValue() uint32 { func (x *AffectedRows) GetValue() uint32 {
@@ -587,7 +672,7 @@ type FlightMetadata struct {
func (x *FlightMetadata) Reset() { func (x *FlightMetadata) Reset() {
*x = FlightMetadata{} *x = FlightMetadata{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_greptime_v1_database_proto_msgTypes[8] mi := &file_greptime_v1_database_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -600,7 +685,7 @@ func (x *FlightMetadata) String() string {
func (*FlightMetadata) ProtoMessage() {} func (*FlightMetadata) ProtoMessage() {}
func (x *FlightMetadata) ProtoReflect() protoreflect.Message { func (x *FlightMetadata) ProtoReflect() protoreflect.Message {
mi := &file_greptime_v1_database_proto_msgTypes[8] mi := &file_greptime_v1_database_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -613,7 +698,7 @@ func (x *FlightMetadata) ProtoReflect() protoreflect.Message {
// Deprecated: Use FlightMetadata.ProtoReflect.Descriptor instead. // Deprecated: Use FlightMetadata.ProtoReflect.Descriptor instead.
func (*FlightMetadata) Descriptor() ([]byte, []int) { func (*FlightMetadata) Descriptor() ([]byte, []int) {
return file_greptime_v1_database_proto_rawDescGZIP(), []int{8} return file_greptime_v1_database_proto_rawDescGZIP(), []int{9}
} }
func (x *FlightMetadata) GetAffectedRows() *AffectedRows { func (x *FlightMetadata) GetAffectedRows() *AffectedRows {
@@ -667,36 +752,46 @@ var file_greptime_v1_database_proto_rawDesc = []byte{
0x65, 0x72, 0x79, 0x12, 0x2b, 0x0a, 0x03, 0x64, 0x64, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x65, 0x72, 0x79, 0x12, 0x2b, 0x0a, 0x03, 0x64, 0x64, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x17, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44,
0x64, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x03, 0x64, 0x64, 0x6c, 0x64, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x03, 0x64, 0x64, 0x6c,
0x42, 0x09, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x50, 0x0a, 0x0c, 0x51, 0x42, 0x09, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x99, 0x01, 0x0a, 0x0c,
0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x03, 0x73, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x03,
0x71, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x73, 0x71, 0x6c, 0x12, 0x73, 0x71, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x73, 0x71, 0x6c,
0x23, 0x0a, 0x0c, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x18, 0x12, 0x23, 0x0a, 0x0c, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x70, 0x6c, 0x61, 0x6e,
0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0b, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0b, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x61,
0x50, 0x6c, 0x61, 0x6e, 0x42, 0x07, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x22, 0x9f, 0x01, 0x6c, 0x50, 0x6c, 0x61, 0x6e, 0x12, 0x47, 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x6d, 0x5f, 0x72, 0x61,
0x0a, 0x0d, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x6e, 0x67, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x1d, 0x0a, 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x1b, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72,
0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2d, 0x6f, 0x6d, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x48, 0x00, 0x52, 0x0e,
0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x70, 0x72, 0x6f, 0x6d, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x07,
0x13, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x22, 0x62, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x6d, 0x52,
0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x1b, 0x0a, 0x61, 0x6e, 0x67, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65,
0x09, 0x72, 0x6f, 0x77, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12,
0x52, 0x08, 0x72, 0x6f, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01,
0x0d, 0x52, 0x0c, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x28, 0x09, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18,
0x24, 0x0a, 0x0c, 0x41, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65, 0x64, 0x52, 0x6f, 0x77, 0x73, 0x12, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x22, 0x9f, 0x01, 0x0a, 0x0d,
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x50, 0x0a, 0x0e, 0x46, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x4d, 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x3e, 0x0a, 0x0d, 0x61, 0x66, 0x66, 0x65, 0x63, 0x09, 0x52, 0x09, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2d, 0x0a, 0x07,
0x74, 0x65, 0x64, 0x5f, 0x72, 0x6f, 0x77, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e,
0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x66, 0x66, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x75,
0x65, 0x63, 0x74, 0x65, 0x64, 0x52, 0x6f, 0x77, 0x73, 0x52, 0x0c, 0x61, 0x66, 0x66, 0x65, 0x63, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x72,
0x74, 0x65, 0x64, 0x52, 0x6f, 0x77, 0x73, 0x42, 0x51, 0x0a, 0x0e, 0x69, 0x6f, 0x2e, 0x67, 0x72, 0x6f, 0x77, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08,
0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x08, 0x44, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x67, 0x69,
0x61, 0x73, 0x65, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52,
0x47, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x2f, 0x67, 0x72, 0x65, 0x0c, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x24, 0x0a,
0x70, 0x74, 0x69, 0x6d, 0x65, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x0c, 0x41, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65, 0x64, 0x52, 0x6f, 0x77, 0x73, 0x12, 0x14, 0x0a,
0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, 0x61,
0x6f, 0x33, 0x6c, 0x75, 0x65, 0x22, 0x50, 0x0a, 0x0e, 0x46, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x4d, 0x65, 0x74,
0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x3e, 0x0a, 0x0d, 0x61, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65,
0x64, 0x5f, 0x72, 0x6f, 0x77, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67,
0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x66, 0x66, 0x65, 0x63,
0x74, 0x65, 0x64, 0x52, 0x6f, 0x77, 0x73, 0x52, 0x0c, 0x61, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65,
0x64, 0x52, 0x6f, 0x77, 0x73, 0x42, 0x51, 0x0a, 0x0e, 0x69, 0x6f, 0x2e, 0x67, 0x72, 0x65, 0x70,
0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x08, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73,
0x65, 0x5a, 0x35, 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, 0x67, 0x72, 0x65,
0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@@ -711,7 +806,7 @@ func file_greptime_v1_database_proto_rawDescGZIP() []byte {
return file_greptime_v1_database_proto_rawDescData return file_greptime_v1_database_proto_rawDescData
} }
var file_greptime_v1_database_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_greptime_v1_database_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_greptime_v1_database_proto_goTypes = []interface{}{ var file_greptime_v1_database_proto_goTypes = []interface{}{
(*RequestHeader)(nil), // 0: greptime.v1.RequestHeader (*RequestHeader)(nil), // 0: greptime.v1.RequestHeader
(*AuthHeader)(nil), // 1: greptime.v1.AuthHeader (*AuthHeader)(nil), // 1: greptime.v1.AuthHeader
@@ -719,27 +814,29 @@ var file_greptime_v1_database_proto_goTypes = []interface{}{
(*Token)(nil), // 3: greptime.v1.Token (*Token)(nil), // 3: greptime.v1.Token
(*GreptimeRequest)(nil), // 4: greptime.v1.GreptimeRequest (*GreptimeRequest)(nil), // 4: greptime.v1.GreptimeRequest
(*QueryRequest)(nil), // 5: greptime.v1.QueryRequest (*QueryRequest)(nil), // 5: greptime.v1.QueryRequest
(*InsertRequest)(nil), // 6: greptime.v1.InsertRequest (*PromRangeQuery)(nil), // 6: greptime.v1.PromRangeQuery
(*AffectedRows)(nil), // 7: greptime.v1.AffectedRows (*InsertRequest)(nil), // 7: greptime.v1.InsertRequest
(*FlightMetadata)(nil), // 8: greptime.v1.FlightMetadata (*AffectedRows)(nil), // 8: greptime.v1.AffectedRows
(*DdlRequest)(nil), // 9: greptime.v1.DdlRequest (*FlightMetadata)(nil), // 9: greptime.v1.FlightMetadata
(*Column)(nil), // 10: greptime.v1.Column (*DdlRequest)(nil), // 10: greptime.v1.DdlRequest
(*Column)(nil), // 11: greptime.v1.Column
} }
var file_greptime_v1_database_proto_depIdxs = []int32{ var file_greptime_v1_database_proto_depIdxs = []int32{
1, // 0: greptime.v1.RequestHeader.authorization:type_name -> greptime.v1.AuthHeader 1, // 0: greptime.v1.RequestHeader.authorization:type_name -> greptime.v1.AuthHeader
2, // 1: greptime.v1.AuthHeader.basic:type_name -> greptime.v1.Basic 2, // 1: greptime.v1.AuthHeader.basic:type_name -> greptime.v1.Basic
3, // 2: greptime.v1.AuthHeader.token:type_name -> greptime.v1.Token 3, // 2: greptime.v1.AuthHeader.token:type_name -> greptime.v1.Token
0, // 3: greptime.v1.GreptimeRequest.header:type_name -> greptime.v1.RequestHeader 0, // 3: greptime.v1.GreptimeRequest.header:type_name -> greptime.v1.RequestHeader
6, // 4: greptime.v1.GreptimeRequest.insert:type_name -> greptime.v1.InsertRequest 7, // 4: greptime.v1.GreptimeRequest.insert:type_name -> greptime.v1.InsertRequest
5, // 5: greptime.v1.GreptimeRequest.query:type_name -> greptime.v1.QueryRequest 5, // 5: greptime.v1.GreptimeRequest.query:type_name -> greptime.v1.QueryRequest
9, // 6: greptime.v1.GreptimeRequest.ddl:type_name -> greptime.v1.DdlRequest 10, // 6: greptime.v1.GreptimeRequest.ddl:type_name -> greptime.v1.DdlRequest
10, // 7: greptime.v1.InsertRequest.columns:type_name -> greptime.v1.Column 6, // 7: greptime.v1.QueryRequest.prom_range_query:type_name -> greptime.v1.PromRangeQuery
7, // 8: greptime.v1.FlightMetadata.affected_rows:type_name -> greptime.v1.AffectedRows 11, // 8: greptime.v1.InsertRequest.columns:type_name -> greptime.v1.Column
9, // [9:9] is the sub-list for method output_type 8, // 9: greptime.v1.FlightMetadata.affected_rows:type_name -> greptime.v1.AffectedRows
9, // [9:9] is the sub-list for method input_type 10, // [10:10] is the sub-list for method output_type
9, // [9:9] is the sub-list for extension type_name 10, // [10:10] is the sub-list for method input_type
9, // [9:9] is the sub-list for extension extendee 10, // [10:10] is the sub-list for extension type_name
0, // [0:9] is the sub-list for field type_name 10, // [10:10] is the sub-list for extension extendee
0, // [0:10] is the sub-list for field type_name
} }
func init() { file_greptime_v1_database_proto_init() } func init() { file_greptime_v1_database_proto_init() }
@@ -823,7 +920,7 @@ func file_greptime_v1_database_proto_init() {
} }
} }
file_greptime_v1_database_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { file_greptime_v1_database_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*InsertRequest); i { switch v := v.(*PromRangeQuery); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@@ -835,7 +932,7 @@ func file_greptime_v1_database_proto_init() {
} }
} }
file_greptime_v1_database_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { file_greptime_v1_database_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AffectedRows); i { switch v := v.(*InsertRequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@@ -847,6 +944,18 @@ func file_greptime_v1_database_proto_init() {
} }
} }
file_greptime_v1_database_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { file_greptime_v1_database_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AffectedRows); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_greptime_v1_database_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FlightMetadata); i { switch v := v.(*FlightMetadata); i {
case 0: case 0:
return &v.state return &v.state
@@ -871,6 +980,7 @@ func file_greptime_v1_database_proto_init() {
file_greptime_v1_database_proto_msgTypes[5].OneofWrappers = []interface{}{ file_greptime_v1_database_proto_msgTypes[5].OneofWrappers = []interface{}{
(*QueryRequest_Sql)(nil), (*QueryRequest_Sql)(nil),
(*QueryRequest_LogicalPlan)(nil), (*QueryRequest_LogicalPlan)(nil),
(*QueryRequest_PromRangeQuery)(nil),
} }
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
@@ -878,7 +988,7 @@ func file_greptime_v1_database_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_greptime_v1_database_proto_rawDesc, RawDescriptor: file_greptime_v1_database_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 9, NumMessages: 10,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },
+8
View File
@@ -47,9 +47,17 @@ message QueryRequest {
oneof query { oneof query {
string sql = 1; string sql = 1;
bytes logical_plan = 2; bytes logical_plan = 2;
PromRangeQuery prom_range_query = 3;
} }
} }
message PromRangeQuery {
string query = 1;
string start = 2;
string end = 3;
string step = 4;
}
message InsertRequest { message InsertRequest {
string table_name = 1; string table_name = 1;
+1 -1
View File
@@ -45,7 +45,7 @@ impl PeerDict {
} }
} }
#[allow(clippy::derive_hash_xor_eq)] #[allow(clippy::derived_hash_with_manual_eq)]
impl Hash for Peer { impl Hash for Peer {
fn hash<H: Hasher>(&self, state: &mut H) { fn hash<H: Hasher>(&self, state: &mut H) {
self.id.hash(state); self.id.hash(state);