You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2023/04/08 07:45:17 UTC

[doris] branch master updated: [fix](inverted index) Fix key column match query failed (#18436)

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

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 0b8bc51b72 [fix](inverted index) Fix key column match query failed (#18436)
0b8bc51b72 is described below

commit 0b8bc51b72ba5c893cb3a40389a2a48b95eb161f
Author: YueW <45...@users.noreply.github.com>
AuthorDate: Sat Apr 8 15:45:08 2023 +0800

    [fix](inverted index) Fix key column match query failed (#18436)
    
    * [fix](inverted index) Fix key column match query failed
    
    * [chore](regression case) add regression case
    
    * [fix] fix regression case no order by
---
 be/src/exec/olap_common.h                          |  1 +
 .../test_index_key_match_select.out                | 10 +++++
 .../test_index_key_match_select.groovy             | 49 ++++++++++++++++++++++
 3 files changed, 60 insertions(+)

diff --git a/be/src/exec/olap_common.h b/be/src/exec/olap_common.h
index 2ea304b7b9..d0b6191927 100644
--- a/be/src/exec/olap_common.h
+++ b/be/src/exec/olap_common.h
@@ -1135,6 +1135,7 @@ Status OlapScanKeys::extend_scan_key(ColumnValueRange<primitive_type>& range,
         _end_include = true;
         *exact_value = false;
         // not empty, do nothing
+        return Status::OK();
     }
 
     // 3.1 extend ScanKey with FixedValueRange
diff --git a/regression-test/data/inverted_index_p0/test_index_key_match_select.out b/regression-test/data/inverted_index_p0/test_index_key_match_select.out
new file mode 100644
index 0000000000..c968dd49cd
--- /dev/null
+++ b/regression-test/data/inverted_index_p0/test_index_key_match_select.out
@@ -0,0 +1,10 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql --
+u1	['u2', 'u3']
+u2	['u1', 'u3', 'u4']
+
+-- !sql --
+u1	['u2', 'u3']
+u2	['u1', 'u3', 'u4']
+u3	['u1']
+
diff --git a/regression-test/suites/inverted_index_p0/test_index_key_match_select.groovy b/regression-test/suites/inverted_index_p0/test_index_key_match_select.groovy
new file mode 100644
index 0000000000..dc04ba8786
--- /dev/null
+++ b/regression-test/suites/inverted_index_p0/test_index_key_match_select.groovy
@@ -0,0 +1,49 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_index_key_match_select", "inverted_index_select"){
+    def indexTbName1 = "index_key_match_select"
+    def varchar_colume1 = "user"
+    def array_string_colume2 = "followers"
+
+    sql "DROP TABLE IF EXISTS ${indexTbName1}"
+
+    // create table with different index
+    sql """
+            CREATE TABLE IF NOT EXISTS ${indexTbName1} (
+                ${varchar_colume1} varchar(500),
+                ${array_string_colume2} array<string>,
+                INDEX ${varchar_colume1}_idx(${varchar_colume1}) USING INVERTED PROPERTIES("parser"="english") COMMENT '${varchar_colume1} index',
+                INDEX ${array_string_colume2}_idx(${array_string_colume2}) USING INVERTED PROPERTIES("parser"="english") COMMENT '${array_string_colume2} index'
+            )
+            DUPLICATE KEY(`user`)
+            DISTRIBUTED BY HASH(`user`) BUCKETS 10
+            properties("replication_num" = "1");
+    """
+
+    // insert data
+    // ${varchar_colume1}, ${array_string_colume2}
+    // user, followers
+    sql """ insert into ${indexTbName1} VALUES
+        ("u1", ["u2","u3"]),
+        ("u2", ["u1","u3","u4"]),
+        ("u3", ["u1"]),
+        ("u4", ["u3"])
+    """
+    qt_sql "SELECT * FROM ${indexTbName1} WHERE user MATCH_ANY 'u1, u2' ORDER BY user LIMIT 10;"
+    qt_sql "SELECT * FROM ${indexTbName1} WHERE user MATCH_ANY 'u1, u2, u3' ORDER BY user LIMIT 10;"
+}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org