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 2022/05/22 14:21:40 UTC

[skywalking-banyandb] branch query-top updated (630354c -> 14079fd)

This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a change to branch query-top
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git


 discard 630354c  Rearrage the result of topN
     add c194333  Support filter tags based on non-indexed tags for meausre. (#120)
     new 14079fd  Rearrage the result of topN

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (630354c)
            \
             N -- N -- N   refs/heads/query-top (14079fd)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 banyand/metadata/metadata_test.go                  |   1 +
 banyand/stream/stream_query_test.go                | 146 +++++++++++
 banyand/stream/stream_write_test.go                |   5 +-
 banyand/stream/testdata/multiple_shards.json       |  27 ++-
 banyand/tsdb/index/writer.go                       | 166 +++++++------
 pkg/bus/bus_test.go                                |  38 +--
 pkg/index/tree.go                                  |  30 +--
 pkg/pb/v1/write.go                                 |  99 +++++++-
 pkg/query/logical/expr.go                          |  12 +-
 pkg/query/logical/expr_literal.go                  | 138 +++++++++++
 pkg/query/logical/interface.go                     |   9 +
 pkg/query/logical/stream_analyzer.go               |   4 +-
 pkg/query/logical/stream_analyzer_test.go          |  29 ++-
 pkg/query/logical/stream_plan_execution_test.go    |  59 +++--
 pkg/query/logical/stream_plan_indexscan_global.go  |  18 +-
 pkg/query/logical/stream_plan_indexscan_local.go   | 129 +---------
 pkg/query/logical/stream_plan_tag_filter.go        | 269 +++++++++++++++++++++
 pkg/query/logical/testdata/global_index.json       |  19 +-
 pkg/test/stream/testdata/index_rule_binding.json   |   3 +-
 .../stream/testdata/index_rules/extended_tags.json |   6 +-
 pkg/test/stream/testdata/stream.json               |   8 +
 21 files changed, 912 insertions(+), 303 deletions(-)
 create mode 100644 pkg/query/logical/stream_plan_tag_filter.go
 copy banyand/metadata/schema/testdata/index_rules/endpoint_id.json => pkg/test/stream/testdata/index_rules/extended_tags.json (72%)


[skywalking-banyandb] 01/01: Rearrage the result of topN

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch query-top
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git

commit 14079fd2b0bb61a03c7756f8573b4acbcec93ffe
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Sun May 22 14:10:02 2022 +0000

    Rearrage the result of topN
    
    Signed-off-by: Gao Hongtao <ha...@gmail.com>
---
 pkg/query/logical/measure_plan_execution_test.go | 28 ++++++++++++++----------
 pkg/query/logical/measure_plan_top.go            | 15 +++++--------
 2 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/pkg/query/logical/measure_plan_execution_test.go b/pkg/query/logical/measure_plan_execution_test.go
index aaed872..117382f 100644
--- a/pkg/query/logical/measure_plan_execution_test.go
+++ b/pkg/query/logical/measure_plan_execution_test.go
@@ -109,13 +109,15 @@ func TestMeasurePlanExecution_IndexScan(t *testing.T) {
 			dataSize := 0
 			for iter.Next() {
 				dataPoints := iter.Current()
-				for _, dp := range dataPoints {
-					dataSize++
-					tester.Len(dp.GetFields(), tt.fieldLength)
-					tester.Len(dp.GetTagFamilies(), len(tt.tagLength))
-					for tagFamilyIdx, tagFamily := range dp.GetTagFamilies() {
-						tester.Len(tagFamily.GetTags(), tt.tagLength[tagFamilyIdx])
-					}
+				if len(dataPoints) < 1 {
+					continue
+				}
+				dp := dataPoints[0]
+				dataSize++
+				tester.Len(dp.GetFields(), tt.fieldLength)
+				tester.Len(dp.GetTagFamilies(), len(tt.tagLength))
+				for tagFamilyIdx, tagFamily := range dp.GetTagFamilies() {
+					tester.Len(tagFamily.GetTags(), tt.tagLength[tagFamilyIdx])
 				}
 			}
 			tester.Equal(dataSize, tt.wantLength)
@@ -343,11 +345,13 @@ func TestMeasurePlanExecution_Cursor(t *testing.T) {
 			got := make([]int64, 0)
 			for iter.Next() {
 				dataPoints := iter.Current()
-				for _, dp := range dataPoints {
-					for _, f := range dp.Fields {
-						if f.Name == "value" {
-							got = append(got, f.Value.GetInt().Value)
-						}
+				if len(dataPoints) < 1 {
+					continue
+				}
+				dp := dataPoints[0]
+				for _, f := range dp.Fields {
+					if f.Name == "value" {
+						got = append(got, f.Value.GetInt().Value)
 					}
 				}
 			}
diff --git a/pkg/query/logical/measure_plan_top.go b/pkg/query/logical/measure_plan_top.go
index d250855..cf55dc6 100644
--- a/pkg/query/logical/measure_plan_top.go
+++ b/pkg/query/logical/measure_plan_top.go
@@ -119,28 +119,23 @@ func (g *top) Execute(ec executor.MeasureExecutionContext) (executor.MIterator,
 
 type topMIterator struct {
 	elements []TopElement
-	current  []*measurev1.DataPoint
+	index    int
 }
 
 func newTopMIterator(elements []TopElement) executor.MIterator {
 	return &topMIterator{
 		elements: elements,
+		index:    -1,
 	}
 }
 
 func (ami *topMIterator) Next() bool {
-	if ami.current != nil {
-		return false
-	}
-	ami.current = make([]*measurev1.DataPoint, 0, len(ami.elements))
-	for _, tn := range ami.elements {
-		ami.current = append(ami.current, tn.dp)
-	}
-	return true
+	ami.index++
+	return ami.index < len(ami.elements)
 }
 
 func (ami *topMIterator) Current() []*measurev1.DataPoint {
-	return ami.current
+	return []*measurev1.DataPoint{ami.elements[ami.index].dp}
 }
 
 func (ami *topMIterator) Close() error {