airborne12 commented on code in PR #70886:
URL: https://github.com/apache/doris/pull/70886#discussion_r4665358070


##########
regression-test/suites/search/test_search_condition_cache.groovy:
##########
@@ -0,0 +1,128 @@
+// 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.
+
+// The BE condition cache must key SEARCH results by the DSL, not only by the 
bound columns.
+// A residual predicate that the index cannot answer keeps the cache in use 
for the segment.
+suite("test_search_condition_cache", "p0") {
+    sql "SET enable_sql_cache = false"
+    sql "SET enable_inverted_index_query_cache = false"
+    sql "SET enable_count_on_index_pushdown = false"
+
+    def textTable = "search_condition_cache_text"
+    def variantTable = "search_condition_cache_variant"
+
+    def textIds = { String dsl ->
+        def rows = sql """
+            SELECT id FROM ${textTable}
+            WHERE abs(d) >= 100 AND SEARCH('${dsl}', 
'{"default_field":"s","mode":"lucene","default_operator":"and"}')
+            ORDER BY id
+        """
+        return rows.collect { it[0] as long }
+    }
+    def variantCount = { String dsl ->
+        def rows = sql """
+            SELECT COUNT(*) FROM ${variantTable}
+            WHERE CAST(payload['datetime_7'] AS BIGINT) >= 100
+              AND SEARCH('${dsl}', 
'{"default_field":"payload.string_8","mode":"lucene","default_operator":"and"}')
+        """
+        return rows[0][0] as long
+    }
+
+    def createTextTable = {
+        sql "DROP TABLE IF EXISTS ${textTable}"
+        sql """
+            CREATE TABLE ${textTable} (
+                id BIGINT NOT NULL,
+                s TEXT NULL,
+                d BIGINT NULL,
+                INDEX idx_s (s) USING INVERTED
+            ) DUPLICATE KEY(id)
+            DISTRIBUTED BY HASH(id) BUCKETS 1
+            PROPERTIES ("replication_num" = "1", 
"inverted_index_storage_format" = "V2")
+        """
+        // Rows sit in key order, so `alpha` is in the first 2048-row granule 
and `beta` in the second.
+        sql """
+            INSERT INTO ${textTable}
+            SELECT number,
+                   CASE number WHEN 1 THEN 'alpha' WHEN 3000 THEN 'beta' ELSE 
'filler' END,
+                   200
+            FROM numbers("number" = "4096")
+        """
+        sql "sync"
+    }
+    def createVariantTable = {

Review Comment:
   Fixed in 6f55f4b960d: the suite now sets 
enable_match_without_inverted_index, debug_variant_enable_typed_paths_to_sparse 
and debug_variant_enable_doc_mode to false before creating its tables, as the 
neighboring VARIANT SEARCH suites do.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to