github-actions[bot] commented on code in PR #68853:
URL: https://github.com/apache/doris/pull/68853#discussion_r4347723024


##########
regression-test/suites/query_p0/cache/test_file_type_sql_cache.groovy:
##########
@@ -0,0 +1,82 @@
+// 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.
+
+// Exercise the real FE/BE SQL result cache, including a verified cache plan.
+// Internal six-child payload retention is covered separately by QueryCache BE 
tests.
+suite("test_file_type_sql_cache") {
+    def publicStruct = "STRUCT<uri:VARCHAR(65533),offset:BIGINT,size:BIGINT," +
+            
"content_type:VARCHAR(1024),checksum:VARCHAR(1024),inline:VARBINARY>"
+    def hasSqlCache = { String statement ->
+        sql("EXPLAIN PHYSICAL PLAN " + statement).collect { it[0].toString() }
+                .join("\n").contains("PhysicalSqlCache")
+    }
+    def primeSqlCache = { String statement ->
+        for (int attempt = 0; attempt < 60; ++attempt) {
+            sql statement
+            if (hasSqlCache(statement)) {
+                return
+            }
+            sleep(1000)
+        }
+        throw new IllegalStateException("FILE query did not populate the SQL 
result cache: " + statement)
+    }
+
+    withGlobalLock("cache_last_version_interval_second") {
+        def originalInterval = sql("ADMIN SHOW FRONTEND CONFIG LIKE 
'cache_last_version_interval_second'")[0][1]
+        try {
+            sql "ADMIN SET ALL FRONTENDS CONFIG 
('cache_last_version_interval_second' = '0')"
+            sql "SET enable_sql_cache = true"
+            sql "DROP TABLE IF EXISTS test_file_type_sql_cache_values"
+            sql """
+                CREATE TABLE test_file_type_sql_cache_values (
+                    id INT NOT NULL, uri STRING, file_offset BIGINT, file_size 
BIGINT,
+                    content_type STRING, checksum STRING)
+                DUPLICATE KEY(id) DISTRIBUTED BY HASH(id) BUCKETS 1
+                PROPERTIES("replication_num"="1")
+            """
+            sql """
+                INSERT INTO test_file_type_sql_cache_values VALUES
+                (1, 'urn:cache:one', 2, 5, 'text/plain', 'CRC32:00000000'),
+                (2, NULL, NULL, NULL, NULL, NULL)
+            """
+            def statement = """
+                SELECT id, f,
+                       CAST(ARRAY(CAST(f AS ${publicStruct}), NULL) AS 
ARRAY<FILE>) AS files,

Review Comment:
   [P2] Remove the unsupported reverse casts from the cache/spill suites
   
   `f` is already FILE here, but `ExpressionAnalyzer.visitCast()` calls 
`checkCanCastTo()` and `CheckCast.checkFileCast()` rejects FILE-to-STRUCT in 
both cast modes. Consequently `qt_uncached` fails during analysis before cache 
priming; `test_file_type_spill.groovy:37` uses the same forbidden cast and its 
first `qt_sort` also fails before spill executes. Construct these containers 
directly with `ARRAY(f, NULL)`, `NAMED_STRUCT('f', f)` and `MAP('source', f)`, 
then regenerate the expected output through the suites.



-- 
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