zfr9527 commented on code in PR #60260:
URL: https://github.com/apache/doris/pull/60260#discussion_r2731543868


##########
regression-test/suites/nereids_function_p0/gen_function/unnest_where_list_test.groovy:
##########
@@ -0,0 +1,129 @@
+// 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("unnest_where_list_test", "unnest") {
+
+    String prefix_str = "unnest_where_list_"
+    def tb_name1 = prefix_str + "table1"
+    def tb_name2 = prefix_str + "table2"
+
+    sql """drop table if exists ${tb_name1}"""
+    sql """
+        CREATE TABLE IF NOT EXISTS ${tb_name1} (
+            user_id INT,
+            user_name VARCHAR(50),
+            user_type VARCHAR(20),
+            tags ARRAY<STRING>,
+            login_days BITMAP,
+            ext_props MAP<STRING, STRING>
+        ) 
+        DUPLICATE KEY(user_id)
+        DISTRIBUTED BY HASH(user_id) BUCKETS 1
+        PROPERTIES ("replication_num" = "1");"""
+
+    sql """INSERT INTO ${tb_name1} VALUES
+        (1, 'Alice', 'VIP', ['tech', 'music', 'sport'], bitmap_from_string("1, 
2, 10"), {'level': 'gold'}),
+        (2, 'Bob', 'Normal', ['teach', 'math'], bitmap_from_string("15, 20"), 
{'level': 'silver'}),
+        (3, 'Charlie', 'Normal', [], bitmap_empty(), {}),
+        (4, 'David', 'VIP', NULL, bitmap_empty(), NULL);"""
+
+    sql """drop table if exists ${tb_name2}"""
+    sql """
+        CREATE TABLE IF NOT EXISTS ${tb_name2} (
+            ref_id INT,
+            ref_tag STRING
+        ) DISTRIBUTED BY HASH(ref_id) BUCKETS 1 PROPERTIES ("replication_num" 
= "1");"""
+
+    sql """INSERT INTO ${tb_name2} VALUES (1, 'tech'), (2, 'math');"""
+
+    // subquery nested
+    test {
+        // Test a correlated EXISTS subquery with UNNEST in the WHERE clause, 
which is expected to fail.
+        sql """SELECT user_name FROM ${tb_name1} u WHERE EXISTS (SELECT 1 FROM 
UNNEST(u.tags) AS t(tag) WHERE t.tag = 'tech');"""
+        exception "Input slot(s) not in child's output"
+    }
+
+    test {
+        // Test a correlated IN subquery with UNNEST in the WHERE clause, 
which is expected to fail.
+        sql """SELECT user_name FROM ${tb_name1} u WHERE 'math' IN (SELECT tag 
FROM UNNEST(u.tags) AS t(tag));"""
+        exception "detailMessage"

Review Comment:
   There is still a bit of an issue in the code logic, which makes it 
impossible to clearly specify the exact error message here; overall, just 
reporting an error is fine



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