-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0aa95e5
commit 1b40cc5
Showing
3 changed files
with
263 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
153 changes: 153 additions & 0 deletions
153
regression-test/data/nereids_rules_p0/split_join_for_null_skew/split_join_for_null_skew.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !int -- | ||
\N 103 \N \N | ||
\N 107 \N \N | ||
1 100 apple 2023-01-01T10:00 | ||
1 100 apple 2023-01-01T10:00 | ||
1 100 apple 2023-01-01T10:00 | ||
1 100 apple 2023-01-01T10:00 | ||
2 101 banana 2023-01-02T11:00 | ||
3 102 cherry 2023-01-03T12:00 | ||
3 102 cherry 2023-01-03T12:00 | ||
3 102 cherry 2023-01-03T12:00 | ||
3 102 cherry 2023-01-03T12:00 | ||
4 104 elderberry 2023-01-05T14:00 | ||
5 105 \N 2023-01-06T15:00 | ||
5 105 \N 2023-01-06T15:00 | ||
5 105 \N 2023-01-06T15:00 | ||
5 105 \N 2023-01-06T15:00 | ||
6 106 fig 2023-01-07T16:00 | ||
|
||
-- !on_condition_has_plus_expr -- | ||
\N 103 \N \N | ||
\N 107 \N \N | ||
1 100 2 101 | ||
1 100 2 101 | ||
2 101 3 102 | ||
2 101 3 102 | ||
3 102 4 104 | ||
3 102 4 104 | ||
4 104 5 105 | ||
4 104 5 105 | ||
5 105 6 106 | ||
5 105 6 106 | ||
6 106 \N \N | ||
|
||
-- !on_condition_has_abs_expr -- | ||
\N 103 \N \N | ||
\N 107 \N \N | ||
1 100 1 100 | ||
1 100 1 100 | ||
1 100 1 100 | ||
1 100 1 100 | ||
2 101 2 101 | ||
3 102 3 102 | ||
3 102 3 102 | ||
3 102 3 102 | ||
3 102 3 102 | ||
4 104 4 104 | ||
5 105 5 105 | ||
5 105 5 105 | ||
5 105 5 105 | ||
5 105 5 105 | ||
6 106 6 106 | ||
|
||
-- !varchar -- | ||
\N 103 2023-01-04T13:00 date | ||
\N 107 2023-01-08T17:00 grape | ||
1 100 2023-01-01T10:00 apple | ||
1 100 2023-01-01T10:00 apple | ||
1 100 2023-01-01T10:00 apple | ||
1 100 2023-01-01T10:00 apple | ||
2 101 2023-01-02T11:00 banana | ||
3 102 2023-01-03T12:00 cherry | ||
3 102 2023-01-03T12:00 cherry | ||
3 102 2023-01-03T12:00 cherry | ||
3 102 2023-01-03T12:00 cherry | ||
4 104 2023-01-05T14:00 elderberry | ||
5 105 \N \N | ||
5 105 \N \N | ||
6 106 2023-01-07T16:00 fig | ||
|
||
-- !datetime -- | ||
100 100 1 apple | ||
100 100 1 apple | ||
100 100 1 apple | ||
100 100 1 apple | ||
101 101 2 banana | ||
102 102 3 cherry | ||
102 102 3 cherry | ||
102 102 3 cherry | ||
102 102 3 cherry | ||
103 103 \N date | ||
104 104 4 elderberry | ||
105 105 5 \N | ||
105 105 5 \N | ||
105 105 5 \N | ||
105 105 5 \N | ||
106 106 6 fig | ||
107 107 \N grape | ||
|
||
-- !int_has_filter -- | ||
1 100 2023-01-01T10:00 100 | ||
1 100 2023-01-01T10:00 100 | ||
1 100 2023-01-01T10:00 100 | ||
1 100 2023-01-01T10:00 100 | ||
|
||
-- !int_has_is_not_null -- | ||
2023-01-01T10:00 100 1 100 | ||
2023-01-01T10:00 100 1 100 | ||
2023-01-01T10:00 100 1 100 | ||
2023-01-01T10:00 100 1 100 | ||
2023-01-02T11:00 101 2 101 | ||
2023-01-03T12:00 102 3 102 | ||
2023-01-03T12:00 102 3 102 | ||
2023-01-03T12:00 102 3 102 | ||
2023-01-03T12:00 102 3 102 | ||
2023-01-05T14:00 104 4 104 | ||
2023-01-06T15:00 105 5 105 | ||
2023-01-06T15:00 105 5 105 | ||
2023-01-06T15:00 105 5 105 | ||
2023-01-06T15:00 105 5 105 | ||
2023-01-07T16:00 106 6 106 | ||
|
||
-- !int_has_is_null -- | ||
2023-01-04T13:00 103 \N \N | ||
2023-01-08T17:00 107 \N \N | ||
|
||
-- !varchar -- | ||
\N \N 2023-01-06T15:00 \N | ||
\N \N 2023-01-06T15:00 \N | ||
\N 103 2023-01-04T13:00 date | ||
\N 107 2023-01-08T17:00 grape | ||
1 100 2023-01-01T10:00 apple | ||
1 100 2023-01-01T10:00 apple | ||
1 100 2023-01-01T10:00 apple | ||
1 100 2023-01-01T10:00 apple | ||
2 101 2023-01-02T11:00 banana | ||
3 102 2023-01-03T12:00 cherry | ||
3 102 2023-01-03T12:00 cherry | ||
3 102 2023-01-03T12:00 cherry | ||
3 102 2023-01-03T12:00 cherry | ||
4 104 2023-01-05T14:00 elderberry | ||
6 106 2023-01-07T16:00 fig | ||
|
||
-- !datetime -- | ||
100 100 1 apple | ||
100 100 1 apple | ||
100 100 1 apple | ||
100 100 1 apple | ||
101 101 2 banana | ||
102 102 3 cherry | ||
102 102 3 cherry | ||
102 102 3 cherry | ||
102 102 3 cherry | ||
103 103 \N date | ||
104 104 4 elderberry | ||
105 105 5 \N | ||
105 105 5 \N | ||
105 105 5 \N | ||
105 105 5 \N | ||
106 106 6 fig | ||
107 107 \N grape | ||
|
55 changes: 55 additions & 0 deletions
55
...ion-test/suites/nereids_rules_p0/split_join_for_null_skew/split_join_for_null_skew.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// 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("split_join_for_null_skew") { | ||
sql "set enable_nereids_rules = 'JOIN_SPLIT_FOR_NULL_SKEW'" | ||
|
||
sql "drop table if exists split_join_for_null_skew_t" | ||
sql """create table split_join_for_null_skew_t(a int null, b int not null, c varchar(10) null, d date, dt datetime) | ||
distributed by hash(a) properties("replication_num"="1"); | ||
""" | ||
sql """ | ||
INSERT INTO split_join_for_null_skew_t (a, b, c, d, dt) VALUES | ||
(1, 100, 'apple', '2023-01-01', '2023-01-01 10:00:00'), | ||
(1, 100, 'apple', '2023-01-01', '2023-01-01 10:00:00'), | ||
(2, 101, 'banana', '2023-01-02', '2023-01-02 11:00:00'), | ||
(3, 102, 'cherry', '2023-01-03', '2023-01-03 12:00:00'), | ||
(3, 102, 'cherry', '2023-01-03', '2023-01-03 12:00:00'), | ||
(NULL, 103, 'date', '2023-01-04', '2023-01-04 13:00:00'), | ||
(4, 104, 'elderberry', '2023-01-05', '2023-01-05 14:00:00'), | ||
(5, 105, NULL, '2023-01-06', '2023-01-06 15:00:00'), | ||
(5, 105, NULL, '2023-01-06', '2023-01-06 15:00:00'), | ||
(6, 106, 'fig', '2023-01-07', '2023-01-07 16:00:00'), | ||
(NULL, 107, 'grape', '2023-01-08', '2023-01-08 17:00:00'); | ||
""" | ||
// left join on slot | ||
qt_int "select t1.a,t1.b,t2.c,t2.dt from split_join_for_null_skew_t t1 left join split_join_for_null_skew_t t2 on t1.a=t2.a order by 1,2,3,4" | ||
qt_on_condition_has_plus_expr "select t1.a,t1.b,t2.a,t2.b from split_join_for_null_skew_t t1 left join split_join_for_null_skew_t t2 on t1.a+1=t2.a order by 1,2,3,4" | ||
qt_on_condition_has_abs_expr "select t1.a,t1.b,t2.a,t2.b from split_join_for_null_skew_t t1 left join split_join_for_null_skew_t t2 on abs(t1.a)=t2.a order by 1,2,3,4" | ||
qt_varchar "select t1.a,t1.b,t2.dt,t2.c from split_join_for_null_skew_t t1 left join split_join_for_null_skew_t t2 on t1.c=t2.c order by 1,2,3,4" | ||
qt_datetime "select t2.b,t1.b,t2.a,t2.c from split_join_for_null_skew_t t1 left join split_join_for_null_skew_t t2 on t1.dt=t2.dt order by 1,2,3,4" | ||
|
||
// left join child has filter | ||
qt_int_has_filter "select t1.a,t1.b,t2.dt,t2.b from split_join_for_null_skew_t t1 left join split_join_for_null_skew_t t2 on t1.a=t2.a where t1.a =1 order by 1,2,3,4" | ||
qt_int_has_is_not_null "select t1.dt,t1.b,t2.a,t2.b from split_join_for_null_skew_t t1 left join split_join_for_null_skew_t t2 on t1.a=t2.a where t1.a is not null order by 1,2,3,4" | ||
qt_int_has_is_null "select t1.dt,t1.b,t2.a,t2.b from split_join_for_null_skew_t t1 left join split_join_for_null_skew_t t2 on t1.a=t2.a where t1.a is null order by 1,2,3,4" | ||
|
||
// right join | ||
qt_varchar "select t1.a,t1.b,t2.dt,t2.c from split_join_for_null_skew_t t1 right join split_join_for_null_skew_t t2 on t1.c=t2.c order by 1,2,3,4" | ||
qt_datetime "select t2.b,t1.b,t2.a,t2.c from split_join_for_null_skew_t t1 right join split_join_for_null_skew_t t2 on t1.dt=t2.dt order by 1,2,3,4" | ||
|
||
} |