You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ha...@apache.org on 2021/10/14 09:03:38 UTC
[skywalking-banyandb] 02/03: Add TopNAggregation
This is an automated email from the ASF dual-hosted git repository.
hanahmily pushed a commit to branch api-measure
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git
commit b4c7f6bea4da45e2ba43c8b779feb1cc183fbdaa
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Thu Oct 14 10:03:22 2021 +0800
Add TopNAggregation
Signed-off-by: Gao Hongtao <ha...@gmail.com>
---
api/proto/banyandb/database/v1/schema.proto | 34 +++++++++++++++++++----------
api/proto/banyandb/model/v1/query.proto | 17 ++++++++++-----
2 files changed, 35 insertions(+), 16 deletions(-)
diff --git a/api/proto/banyandb/database/v1/schema.proto b/api/proto/banyandb/database/v1/schema.proto
index 508966f..1646617 100644
--- a/api/proto/banyandb/database/v1/schema.proto
+++ b/api/proto/banyandb/database/v1/schema.proto
@@ -24,6 +24,7 @@ package banyandb.database.v1;
import "google/protobuf/timestamp.proto";
import "banyandb/common/v1/common.proto";
+import "banyandb/model/v1/query.proto";
// Duration represents the elapsed time between two instants
message Duration {
@@ -66,11 +67,7 @@ message Stream {
repeated TagFamilySpec tag_families = 2;
// entity indicates how to generate a series and shard a stream
Entity entity = 3;
- // duration determines how long a TraceSeries keeps its data
- uint32 shard_num = 4;
- Duration duration = 5;
- // updated_at_nanoseconds indicates when the TraceSeries is updated
- google.protobuf.Timestamp updated_at = 6;
+ ResourceOpts opts = 4;
}
message Entity {
@@ -94,6 +91,15 @@ enum CompressionMethod {
COMPRESSION_METHOD_ZSTD = 1;
}
+message ResourceOpts {
+ // shard_num is the number of shards
+ uint32 shard_num = 5;
+ // ttl indicates time to live, how long the data will be cached
+ Duration ttl = 6;
+ // updated_at_nanoseconds indicates when the measure is updated
+ google.protobuf.Timestamp updated_at_nanoseconds = 7;
+}
+
// FieldSpec is the specification of field
message FieldSpec {
// name is the identity of a field
@@ -116,12 +122,18 @@ message Measure {
repeated FieldSpec fields = 3;
// entity indicates which tags will be to generate a series and shard a measure
Entity entity = 4;
- // shard_num is the number of shards
- uint32 shard_num = 5;
- // ttl indicates time to live, how long the data will be cached
- Duration ttl = 6;
- // updated_at_nanoseconds indicates when the measure is updated
- google.protobuf.Timestamp updated_at_nanoseconds = 7;
+ ResourceOpts opts = 5;
+}
+
+message TopNAggregation {
+ // metadata is the identity of a measure
+ common.v1.Metadata metadata = 1;
+ common.v1.Metadata source_measure = 2;
+ string field_name = 3;
+ model.v1.Sort field_value_sort = 4;
+ repeated string group_by = 5;
+ repeated model.v1.Criteria criteria = 6;
+ ResourceOpts opts = 7;
}
// IndexRule defines how to generate indices based on tags and the index type
diff --git a/api/proto/banyandb/model/v1/query.proto b/api/proto/banyandb/model/v1/query.proto
index eaacc9f..06325d3 100644
--- a/api/proto/banyandb/model/v1/query.proto
+++ b/api/proto/banyandb/model/v1/query.proto
@@ -63,15 +63,22 @@ message Condition {
TagValue value = 3;
}
+// tag_families are indexed.
+message Criteria {
+ string tag_family_name = 1;
+ repeated model.v1.Condition conditions = 2;
+}
+
+enum Sort {
+ SORT_UNSPECIFIED = 0;
+ SORT_DESC = 1;
+ SORT_ASC = 2;
+}
+
// QueryOrder means a Sort operation to be done for a given index rule.
// The index_rule_name refers to the name of a index rule bound to the subject.
message QueryOrder {
string index_rule_name = 1;
- enum Sort {
- SORT_UNSPECIFIED = 0;
- SORT_DESC = 1;
- SORT_ASC = 2;
- }
Sort sort = 2;
}