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

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


The following commit(s) were added to refs/heads/main by this push:
     new 6f081f2  Add test cases for handling numeric values of the inverted 
index (#103)
6f081f2 is described below

commit 6f081f2f8e1f59a762513175b9cb69964bb43d07
Author: Gao Hongtao <[email protected]>
AuthorDate: Thu Apr 14 21:34:17 2022 +0800

    Add test cases for handling numeric values of the inverted index (#103)
---
 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",

Reply via email to