Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public Rule build() {
return logicalJoin()
// TODO: we may need another rule to handle on true or on false condition
.when(join -> !join.getOtherJoinConjuncts().isEmpty() && !(join.getOtherJoinConjuncts().size() == 1
&& join.getOtherJoinConjuncts().get(0) instanceof BooleanLiteral))
&& join.getOtherJoinConjuncts().get(0) instanceof BooleanLiteral)
&& !join.isMarkJoin())
.then(join -> {
List<Expression> otherJoinConjuncts = join.getOtherJoinConjuncts();
List<Expression> remainingOther = Lists.newArrayList();
Expand Down
9 changes: 9 additions & 0 deletions regression-test/data/nereids_p0/join/test_mark_join.out
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,12 @@
3 \N true
4 \N false

-- !mark_join7 --
1 p 0
9 1
\N \N 2
\N \N 3
3 4
2 q 5
0 6

19 changes: 18 additions & 1 deletion regression-test/suites/nereids_p0/join/test_mark_join.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ suite("test_mark_join", "nereids_p0") {

sql "drop table if exists `test_mark_join_t1`;"
sql "drop table if exists `test_mark_join_t2`;"
sql "drop table if exists table_7_undef_partitions2_keys3_properties4_distributed_by5;"

sql """
CREATE TABLE IF NOT EXISTS `test_mark_join_t1` (
Expand Down Expand Up @@ -60,6 +61,16 @@ suite("test_mark_join", "nereids_p0") {
);
"""

sql """
create table table_7_undef_partitions2_keys3_properties4_distributed_by5 (
col_int_undef_signed int/*agg_type_placeholder*/ ,
col_varchar_10__undef_signed varchar(10)/*agg_type_placeholder*/ ,
pk int/*agg_type_placeholder*/
) engine=olap
distributed by hash(pk) buckets 10
properties("replication_num" = "1");
"""

sql """
insert into `test_mark_join_t1` values
(1, 1, 1, 'abc', 'efg', 'hjk'),
Expand All @@ -80,6 +91,8 @@ suite("test_mark_join", "nereids_p0") {
);
"""

sql """insert into table_7_undef_partitions2_keys3_properties4_distributed_by5(pk,col_int_undef_signed,col_varchar_10__undef_signed) values (0,1,'p'),(1,9,''),(2,null,null),(3,null,null),(4,3,''),(5,2,'q'),(6,0,'');"""

qt_mark_join1 """
select
k1, k2
Expand Down Expand Up @@ -122,5 +135,9 @@ suite("test_mark_join", "nereids_p0") {
from test_mark_join_t1 order by 1, 2, 3;
"""


qt_mark_join7 """
SELECT * FROM table_7_undef_partitions2_keys3_properties4_distributed_by5 AS t1
WHERE EXISTS ( SELECT MIN(`pk`) FROM table_7_undef_partitions2_keys3_properties4_distributed_by5 AS t2 WHERE t1.pk = 6 )
OR EXISTS ( SELECT `pk` FROM table_7_undef_partitions2_keys3_properties4_distributed_by5 AS t2 WHERE t1.pk = 5 ) order by pk ;
"""
}