github-actions[bot] commented on code in PR #64125: URL: https://github.com/apache/doris/pull/64125#discussion_r3393853460
########## regression-test/suites/query_p0/complex_type/test_complex_type_equality_key.groovy: ########## @@ -0,0 +1,187 @@ +// 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_complex_type_equality_key", "p0") { + sql """set enable_nereids_planner=true""" + sql """set enable_fallback_to_original_planner=false""" + sql """set enable_spill=true""" + + sql """drop table if exists test_complex_type_equality_key_l""" + sql """drop table if exists test_complex_type_equality_key_r""" + + sql """ + create table test_complex_type_equality_key_l ( + id int, + j jsonb, + m map<string, array<int>>, + s struct<a:int,b:array<int>,c:string> + ) duplicate key(id) + distributed by hash(id) buckets 1 + properties ("replication_num" = "1") + """ + + sql """ + create table test_complex_type_equality_key_r ( + id int, + j jsonb, + m map<string, array<int>>, + s struct<a:int,b:array<int>,c:string> + ) duplicate key(id) + distributed by hash(id) buckets 1 + properties ("replication_num" = "1") + """ + + sql """ + insert into test_complex_type_equality_key_l values + (1, '{"a":1,"b":[1,2]}', {'k':[1,2]}, {1,[1,2],'x'}), + (2, '{"a":1,"b":[1,2]}', {'k':[1,2]}, {1,[1,2],'x'}), + (3, '{"a":2,"b":[3]}', {'k':[3]}, {2,[3],'y'}), + (4, '{"a":3,"b":[4]}', {'k':[4]}, {3,[4],'z'}), + (5, null, null, null) + """ + + sql """ + insert into test_complex_type_equality_key_r values + (10, '{"a":1,"b":[1,2]}', {'k':[1,2]}, {1,[1,2],'x'}), + (11, '{"a":2,"b":[3]}', {'k':[3]}, {2,[3],'y'}), + (12, '{"a":4,"b":[5]}', {'k':[5]}, {4,[5],'w'}), + (13, null, null, null) + """ + + order_qt_agg_json """ + select cast(j as string), count(*) + from test_complex_type_equality_key_l + group by j + order by cast(j as string) + """ + + order_qt_agg_map """ + select cast(m as string), count(*) + from test_complex_type_equality_key_l + group by m + order by cast(m as string) + """ + + order_qt_agg_struct """ + select cast(s as string), count(*) + from test_complex_type_equality_key_l + group by s + order by cast(s as string) + """ + + order_qt_join_json """ + select l.id, r.id + from test_complex_type_equality_key_l l + join test_complex_type_equality_key_r r on l.j = r.j Review Comment: This query still fails before the new `CheckAfterRewrite` predicate can allow it. During analysis, `ExpressionAnalyzer.visitComparisonPredicate` calls `TypeCoercionUtils.processComparisonPredicate`; for equal JSON/MAP/STRUCT operands the same-type branch calls `supportCompare(type, false)`, which still rejects JSON, MAP, and STRUCT. That means the new regression cases for `l.j = r.j`, `l.m = r.m`, `l.s = r.s` and the `<=>` variants do not reach planning, so users still cannot use these equality keys. This is distinct from the existing nested unsupported-type thread: the current head is missing the type-coercion admission path entirely. Please update comparison type coercion for equality/null-safe equality to use the same recursive allow/reject predicate. -- 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]
