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/04/14 13:26:18 UTC

[skywalking-banyandb] branch patch-inverted-index created (now 2dc3e19)

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

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


      at 2dc3e19  Add test cases for handling numeric values of the inverted index

This branch includes the following new commits:

     new 2dc3e19  Add test cases for handling numeric values of the inverted index

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.



[skywalking-banyandb] 01/01: Add test cases for handling numeric values of the inverted index

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

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

commit 2dc3e19f80b4810a5c1d00e0539d60c904091d0f
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Thu Apr 14 13:23:20 2022 +0000

    Add test cases for handling numeric values of the inverted index
    
    Signed-off-by: Gao Hongtao <ha...@gmail.com>
---
 banyand/metadata/schema/testdata/stream.json    |  2 +-
 banyand/query/processor_test.go                 |  2 +-
 banyand/query/testdata/global_index.json        |  6 ++--
 banyand/query/testdata/multiple_shards.json     |  6 ++--
 banyand/stream/stream_query_test.go             | 48 +++++++++++++++++++++++++
 banyand/stream/testdata/global_index.json       |  6 ++--
 banyand/stream/testdata/multiple_shards.json    |  6 ++--
 pkg/query/logical/testdata/global_index.json    |  6 ++--
 pkg/query/logical/testdata/multiple_shards.json |  6 ++--
 pkg/test/stream/testdata/stream.json            |  2 +-
 10 files changed, 69 insertions(+), 21 deletions(-)

diff --git a/banyand/metadata/schema/testdata/stream.json b/banyand/metadata/schema/testdata/stream.json
index 451a9f7..313dad1 100644
--- a/banyand/metadata/schema/testdata/stream.json
+++ b/banyand/metadata/schema/testdata/stream.json
@@ -50,7 +50,7 @@
         },
         {
           "name": "status_code",
-          "type": "TAG_TYPE_STRING"
+          "type": "TAG_TYPE_INT"
         },
         {
           "name": "db.type",
diff --git a/banyand/query/processor_test.go b/banyand/query/processor_test.go
index 48f1bf4..ae9fada 100644
--- a/banyand/query/processor_test.go
+++ b/banyand/query/processor_test.go
@@ -395,7 +395,7 @@ var _ = Describe("Stream Query", func() {
 			Limit(10).
 			Offset(0).
 			Metadata("default", "sw").
-			TagsInTagFamily("searchable", "status_code", "=", "500", "duration", "<=", 100).
+			TagsInTagFamily("searchable", "status_code", "=", 500, "duration", "<=", 100).
 			TimeRange(sT, eT).
 			Projection("searchable", "trace_id").
 			Build()
diff --git a/banyand/query/testdata/global_index.json b/banyand/query/testdata/global_index.json
index 9e81928..73c0414 100644
--- a/banyand/query/testdata/global_index.json
+++ b/banyand/query/testdata/global_index.json
@@ -31,7 +31,7 @@
       {"int":{"value": 30}},
       {"int":{"value": 1622933202000000000}},
       {"str":{"value": "GET"}},
-      {"str":{"value": "500"}}
+      {"int":{"value": 500}}
     ]
   },
   {
@@ -44,7 +44,7 @@
       {"int":{"value": 60}},
       {"int":{"value": 1622933202000000000}},
       {"str":{"value": "GET"}},
-      {"str":{"value": "400"}}
+      {"int":{"value": 400}}
     ]
   },
   {
@@ -57,7 +57,7 @@
       {"int":{"value": 300}},
       {"int":{"value": 1622933202000000000}},
       {"str":{"value": "GET"}},
-      {"str":{"value": "500"}}
+      {"int":{"value": 500}}
     ]
   }
   
diff --git a/banyand/query/testdata/multiple_shards.json b/banyand/query/testdata/multiple_shards.json
index ec6427e..402964d 100644
--- a/banyand/query/testdata/multiple_shards.json
+++ b/banyand/query/testdata/multiple_shards.json
@@ -31,7 +31,7 @@
       {"int":{"value": 30}},
       {"int":{"value": 1622933202000000000}},
       {"str":{"value": "GET"}},
-      {"str":{"value": "500"}}
+      {"int":{"value": 500}}
     ]
   },
   {
@@ -44,7 +44,7 @@
       {"int":{"value": 60}},
       {"int":{"value": 1622933202000000000}},
       {"str":{"value": "GET"}},
-      {"str":{"value": "400"}}
+      {"int":{"value": 400}}
     ]
   },
   {
@@ -57,7 +57,7 @@
       {"int":{"value": 300}},
       {"int":{"value": 1622933202000000000}},
       {"str":{"value": "GET"}},
-      {"str":{"value": "500"}}
+      {"int":{"value": 500}}
     ]
   }
   
diff --git a/banyand/stream/stream_query_test.go b/banyand/stream/stream_query_test.go
index 5adb563..35501f7 100644
--- a/banyand/stream/stream_query_test.go
+++ b/banyand/stream/stream_query_test.go
@@ -320,6 +320,54 @@ var _ = Describe("Write", func() {
 					},
 					false,
 				),
+				Entry(
+
+					"filter by status_code",
+					queryOpts{
+						entity:   tsdb.Entity{tsdb.AnyEntry, tsdb.AnyEntry, tsdb.AnyEntry},
+						duration: 1 * time.Hour,
+						buildFn: func(builder tsdb.SeekerBuilder) {
+							rule := &databasev1.IndexRule{
+								Metadata: &commonv1.Metadata{
+									Name:  "status_code",
+									Group: "default",
+									Id:    5,
+								},
+								Tags:     []string{"status_code"},
+								Type:     databasev1.IndexRule_TYPE_INVERTED,
+								Location: databasev1.IndexRule_LOCATION_SERIES,
+							}
+							builder.Filter(rule, tsdb.Condition{
+								"status_code": []index.ConditionValue{
+									{
+										Op:     modelv1.Condition_BINARY_OP_EQ,
+										Values: [][]byte{convert.Int64ToBytes(500)},
+									},
+								},
+							})
+						},
+					},
+					shardsForTest{
+						{
+							id:       0,
+							location: l1,
+						},
+						{
+							id:       1,
+							location: l2,
+						},
+						{
+							id:       1,
+							location: l3,
+						},
+						{
+							id:       1,
+							location: l4,
+							elements: []string{"3", "5"},
+						},
+					},
+					false,
+				),
 				Entry(
 
 					"order by duration",
diff --git a/banyand/stream/testdata/global_index.json b/banyand/stream/testdata/global_index.json
index 9e81928..73c0414 100644
--- a/banyand/stream/testdata/global_index.json
+++ b/banyand/stream/testdata/global_index.json
@@ -31,7 +31,7 @@
       {"int":{"value": 30}},
       {"int":{"value": 1622933202000000000}},
       {"str":{"value": "GET"}},
-      {"str":{"value": "500"}}
+      {"int":{"value": 500}}
     ]
   },
   {
@@ -44,7 +44,7 @@
       {"int":{"value": 60}},
       {"int":{"value": 1622933202000000000}},
       {"str":{"value": "GET"}},
-      {"str":{"value": "400"}}
+      {"int":{"value": 400}}
     ]
   },
   {
@@ -57,7 +57,7 @@
       {"int":{"value": 300}},
       {"int":{"value": 1622933202000000000}},
       {"str":{"value": "GET"}},
-      {"str":{"value": "500"}}
+      {"int":{"value": 500}}
     ]
   }
   
diff --git a/banyand/stream/testdata/multiple_shards.json b/banyand/stream/testdata/multiple_shards.json
index ec6427e..402964d 100644
--- a/banyand/stream/testdata/multiple_shards.json
+++ b/banyand/stream/testdata/multiple_shards.json
@@ -31,7 +31,7 @@
       {"int":{"value": 30}},
       {"int":{"value": 1622933202000000000}},
       {"str":{"value": "GET"}},
-      {"str":{"value": "500"}}
+      {"int":{"value": 500}}
     ]
   },
   {
@@ -44,7 +44,7 @@
       {"int":{"value": 60}},
       {"int":{"value": 1622933202000000000}},
       {"str":{"value": "GET"}},
-      {"str":{"value": "400"}}
+      {"int":{"value": 400}}
     ]
   },
   {
@@ -57,7 +57,7 @@
       {"int":{"value": 300}},
       {"int":{"value": 1622933202000000000}},
       {"str":{"value": "GET"}},
-      {"str":{"value": "500"}}
+      {"int":{"value": 500}}
     ]
   }
   
diff --git a/pkg/query/logical/testdata/global_index.json b/pkg/query/logical/testdata/global_index.json
index 9e81928..73c0414 100644
--- a/pkg/query/logical/testdata/global_index.json
+++ b/pkg/query/logical/testdata/global_index.json
@@ -31,7 +31,7 @@
       {"int":{"value": 30}},
       {"int":{"value": 1622933202000000000}},
       {"str":{"value": "GET"}},
-      {"str":{"value": "500"}}
+      {"int":{"value": 500}}
     ]
   },
   {
@@ -44,7 +44,7 @@
       {"int":{"value": 60}},
       {"int":{"value": 1622933202000000000}},
       {"str":{"value": "GET"}},
-      {"str":{"value": "400"}}
+      {"int":{"value": 400}}
     ]
   },
   {
@@ -57,7 +57,7 @@
       {"int":{"value": 300}},
       {"int":{"value": 1622933202000000000}},
       {"str":{"value": "GET"}},
-      {"str":{"value": "500"}}
+      {"int":{"value": 500}}
     ]
   }
   
diff --git a/pkg/query/logical/testdata/multiple_shards.json b/pkg/query/logical/testdata/multiple_shards.json
index ec6427e..402964d 100644
--- a/pkg/query/logical/testdata/multiple_shards.json
+++ b/pkg/query/logical/testdata/multiple_shards.json
@@ -31,7 +31,7 @@
       {"int":{"value": 30}},
       {"int":{"value": 1622933202000000000}},
       {"str":{"value": "GET"}},
-      {"str":{"value": "500"}}
+      {"int":{"value": 500}}
     ]
   },
   {
@@ -44,7 +44,7 @@
       {"int":{"value": 60}},
       {"int":{"value": 1622933202000000000}},
       {"str":{"value": "GET"}},
-      {"str":{"value": "400"}}
+      {"int":{"value": 400}}
     ]
   },
   {
@@ -57,7 +57,7 @@
       {"int":{"value": 300}},
       {"int":{"value": 1622933202000000000}},
       {"str":{"value": "GET"}},
-      {"str":{"value": "500"}}
+      {"int":{"value": 500}}
     ]
   }
   
diff --git a/pkg/test/stream/testdata/stream.json b/pkg/test/stream/testdata/stream.json
index 451a9f7..313dad1 100644
--- a/pkg/test/stream/testdata/stream.json
+++ b/pkg/test/stream/testdata/stream.json
@@ -50,7 +50,7 @@
         },
         {
           "name": "status_code",
-          "type": "TAG_TYPE_STRING"
+          "type": "TAG_TYPE_INT"
         },
         {
           "name": "db.type",