starocean999 commented on code in PR #49096: URL: https://github.com/apache/doris/pull/49096#discussion_r2194630821
########## regression-test/suites/nereids_rules_p0/salt_join/salt_join.groovy: ########## @@ -0,0 +1,282 @@ +// 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("salt_join") { +// sql "set disable_nereids_rules=JOIN_SKEW_ADD_SALT" + sql "SET ignore_shape_nodes='PhysicalDistribute,PhysicalProject'" + sql "set disable_nereids_rules='prune_empty_partition'" + sql "set runtime_filter_mode=OFF" + sql "drop table if exists test_skew9;" + sql """create table test_skew9(a int,c varchar(100), b int) distributed by hash(a) buckets 32 properties("replication_num"="1");""" + sql """insert into test_skew9 values(1,'abc',9),(1,'abc',1),(1,'def',2),(null,'def',2),(2,'abc',2),(3,'abc',4),(5,'abc',6),(2,'def',2),(5,'abc',null),(3,'abc',null)""" + sql "drop table if exists test_skew10;" + sql """create table test_skew10(a int,c varchar(100), b int) distributed by hash(a) buckets 32 properties("replication_num"="1");""" + sql """insert into test_skew10 values(1,'abc',9),(null,'abc1',3),(1,'def',2),(2,'def1',7),(2,'def',2),(3,'abc',4),(5,'def',8),(2,'def',2),(5,'def',null),(3,'abc',null)""" + qt_simple """ + select * from test_skew9 tl inner join [shuffle(skew(tl.b(1,2)))] test_skew10 tr on tl.b = tr.b order by 1,2,3,4,5,6; + """ + qt_left_simple """ + select * from test_skew9 tl left join [shuffle(skew(tl.b(1,2)))] test_skew10 tr on tl.b = tr.b order by 1,2,3,4,5,6; + """ + qt_right_simple """ + select * from test_skew9 tl right join [shuffle(skew(tl.b(1,2)))] test_skew10 tr on tl.b = tr.b order by 1,2,3,4,5,6; + """ + qt_skew_value_null """ + select * from test_skew9 tl inner join [shuffle(skew(tl.b(1,2,null)))] test_skew10 tr on tl.b = tr.b order by 1,2,3,4,5,6; + """ + qt_skew_value_only_null """ + select * from test_skew9 tl inner join [shuffle(skew(tl.b(null)))] test_skew10 tr on tl.b = tr.b order by 1,2,3,4,5,6; + """ + qt_leading """ + select /*+leading(tl shuffle (skew(tl.b(1,2))) tr) */ * from test_skew9 tl join test_skew10 tr on tl.b=tr.b order by 1,2,3,4,5,6; + """ + qt_has_other_equal_condition """ + select /*+leading(tl shuffle (skew(tl.b(1,2))) tr) */ * from test_skew9 tl join test_skew10 tr on tl.b=tr.b and tl.a=tr.a order by 1,2,3,4,5,6; + """ + qt_has_other_unequal_condition """ + select /*+leading(tl shuffle (skew(tl.b(1,2))) tr) */ * from test_skew9 tl join test_skew10 tr on tl.b=tr.b and tl.a<tr.a order by 1,2,3,4,5,6; + """ + qt_test_varchar_skew_value """ + select /*+leading(tl shuffle (skew(tl.c("abc","def"))) tr) */ * from test_skew9 tl join test_skew10 tr on tl.c=tr.c and tl.a=tr.a order by 1,2,3,4,5,6; + """ + qt_test_multi_join """ + select * from test_skew9 tl inner join [shuffle(skew(tl.b(1,2,null)))] test_skew10 tr on tl.b = tr.b left join [shuffle(skew(tl.b(1,2,null)))] test_skew10 tt on tl.b=tt.b + order by 1,2,3,4,5,6,7,8,9; + """ + qt_test_multi_join_right_join """ + select * from test_skew9 tl inner join [shuffle(skew(tl.b(1,2,null)))] test_skew10 tr on tl.b = tr.b right join [shuffle(skew(tl.b(1,2,null)))] test_skew10 tt on tl.b=tt.b + order by 1,2,3,4,5,6,7,8,9; + """ + qt_test_left_join_right_join """ + select * from test_skew9 tl left join [shuffle(skew(tl.b(1,2,null)))] test_skew10 tr on tl.b = tr.b right join [shuffle(skew(tl.b(1,2,null)))] test_skew10 tt on tl.b=tt.b + order by 1,2,3,4,5,6,7,8,9; + """ + qt_leading_multi_join """ + select /*+leading(tl shuffle (skew(tl.c("abc","def"))) tr shuffle(skew(tl.c("abc","def"))) tt) */ * from + test_skew9 tl join test_skew10 tr on tl.c=tr.c and tl.a=tr.a inner join test_skew10 tt on tl.c = tt.c + order by 1,2,3,4,5,6,7,8,9; + """ + qt_leading_multi_join_bracket """ + select /*+leading(tl shuffle (skew(tl.c("abc","def"))) {tr shuffle(skew(tr.c("abc","def"))) tt}) */ * from Review Comment: in future, we will use () to specify join order precedence instead of {}, so (skew...) may conflict with that. Can we use [skew...] instead of (skew...)? -- 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]
