Skip to content

Commit

Permalink
a and a => a, update rt case
Browse files Browse the repository at this point in the history
  • Loading branch information
englefly committed Nov 28, 2024
1 parent 0404948 commit 9fef1dc
Show file tree
Hide file tree
Showing 14 changed files with 82 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ private static Expression extractCommonFactor(CompoundPredicate originExpr) {
}
if (!canExtract) {
if (childrenSet.size() != originExpr.children().size()) {
return originExpr.withChildren(childrenSet.stream().collect(Collectors.toList()));
if (childrenSet.size() == 1) {
return childrenSet.iterator().next();
} else {
return originExpr.withChildren(childrenSet.stream().collect(Collectors.toList()));
}
}
return originExpr;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ PhysicalResultSink

-- !eliminate_not_null_complex_logic --
PhysicalResultSink
--filter(( not score IS NULL) and ((t.score > 5) OR (t.id < 10)))
--filter(( not score IS NULL) and OR[(t.score > 5),(t.id < 10)])
----PhysicalOlapScan[t]

-- !eliminate_not_null_date_function --
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ PhysicalResultSink
-- !full_outer_join_compound_conditions --
PhysicalResultSink
--PhysicalDistribute[DistributionSpecGather]
----filter(((t1.score > 5) OR (t2.score > 5)))
----filter(OR[(t1.score > 5),(t2.score > 5)])
------hashJoin[FULL_OUTER_JOIN colocated] hashCondition=((t1.id = t2.id)) otherCondition=()
--------PhysicalOlapScan[t]
--------PhysicalOlapScan[t]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ PhysicalResultSink

-- !pushdown_left_outer_join_subquery --
PhysicalResultSink
--NestedLoopJoin[INNER_JOIN]((cast(id as BIGINT) = (sum(id) - 1)) OR id IS NULL)
--NestedLoopJoin[INNER_JOIN]OR[(cast(id as BIGINT) = (sum(id) - 1)),id IS NULL]
----PhysicalOlapScan[t1]
----hashAgg[GLOBAL]
------hashAgg[LOCAL]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ PhysicalResultSink

-- !pushdown_left_outer_join_subquery --
PhysicalResultSink
--filter(((cast(id as BIGINT) = sum(id)) OR id IS NULL))
--filter(OR[(cast(id as BIGINT) = sum(id)),id IS NULL])
----NestedLoopJoin[LEFT_OUTER_JOIN](id = 1)
------PhysicalOlapScan[t1]
------hashAgg[GLOBAL]
Expand All @@ -199,7 +199,7 @@ PhysicalResultSink

-- !pushdown_left_anti_join_subquery --
PhysicalResultSink
--NestedLoopJoin[LEFT_ANTI_JOIN](((t1.id = t2.id) OR id IS NULL) OR id IS NULL)(id > 1)
--NestedLoopJoin[LEFT_ANTI_JOIN]OR[(t1.id = t2.id),id IS NULL,id IS NULL](id > 1)
----PhysicalOlapScan[t1]
----PhysicalOlapScan[t2]

Expand Down Expand Up @@ -229,7 +229,7 @@ PhysicalResultSink

-- !pushdown_left_outer_join_subquery_outer --
PhysicalResultSink
--NestedLoopJoin[INNER_JOIN]((t1.id = t2.id) OR (id IS NULL AND (id > 1)))
--NestedLoopJoin[INNER_JOIN]OR[(t1.id = t2.id),AND[id IS NULL,(id > 1)]]
----PhysicalOlapScan[t1]
----PhysicalAssertNumRows
------PhysicalOlapScan[t2]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ PhysicalResultSink

-- !filter_join_inner --
PhysicalResultSink
--hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=(((t1.id = 1) OR (t2.id = 2)))
--hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=(OR[(t1.id = 1),(t2.id = 2)])
----PhysicalOlapScan[t1]
----PhysicalOlapScan[t2]

Expand All @@ -77,7 +77,7 @@ PhysicalResultSink

-- !filter_join_left --
PhysicalResultSink
--filter(((t1.id = 1) OR (t2.id = 2)))
--filter(OR[(t1.id = 1),(t2.id = 2)])
----hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=()
------PhysicalOlapScan[t1]
------PhysicalOlapScan[t2]
Expand All @@ -104,7 +104,7 @@ PhysicalResultSink

-- !filter_join_left --
PhysicalResultSink
--filter(((t1.id = 1) OR (t2.id = 2)))
--filter(OR[(t1.id = 1),(t2.id = 2)])
----hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=()
------PhysicalOlapScan[t1]
------PhysicalOlapScan[t2]
Expand Down Expand Up @@ -169,7 +169,7 @@ PhysicalResultSink

-- !filter_mixed_inner_left --
PhysicalResultSink
--filter((((t1.id = 1) AND (t2.id = 2)) OR (t3.id = 2)))
--filter(OR[AND[(t1.id = 1),(t2.id = 2)],(t3.id = 2)])
----hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=()
------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=()
--------PhysicalOlapScan[t1]
Expand All @@ -178,7 +178,7 @@ PhysicalResultSink

-- !filter_multi_left --
PhysicalResultSink
--filter((((t1.id = 1) AND (t2.id > 1)) OR (t3.id < 4)))
--filter(OR[AND[(t1.id = 1),(t2.id > 1)],(t3.id < 4)])
----hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=()
------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=()
--------PhysicalOlapScan[t1]
Expand Down Expand Up @@ -236,7 +236,7 @@ PhysicalResultSink

-- !filter_aggregation_group_set --
PhysicalResultSink
--filter(((t1.id > 10) OR (cast(msg as DOUBLE) = 1.0)))
--filter(OR[(t1.id > 10),(cast(msg as DOUBLE) = 1.0)])
----hashAgg[LOCAL]
------PhysicalRepeat
--------PhysicalOlapScan[t1]
Expand Down Expand Up @@ -372,6 +372,6 @@ PhysicalResultSink
----PhysicalQuickSort[LOCAL_SORT]
------PhysicalWindow
--------PhysicalQuickSort[LOCAL_SORT]
----------filter(((t1.msg = '') OR (t1.id = 2)))
----------filter(OR[(t1.msg = ''),(t1.id = 2)])
------------PhysicalOlapScan[t1]

Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ PhysicalResultSink
-- !test_or1 --
PhysicalResultSink
--hashJoin[INNER_JOIN] hashCondition=((t1.a = t2.a)) otherCondition=()
----filter(((t1.a < 2) OR (t1.a > 10)))
----filter(OR[(t1.a < 2),(t1.a > 10)])
------PhysicalOlapScan[extend_infer_t3]
----PhysicalOlapScan[extend_infer_t4]

-- !test_or2 --
PhysicalResultSink
--hashJoin[INNER_JOIN] hashCondition=((t1.a = t2.a)) otherCondition=()
----filter(((t1.a < 2) OR (t1.a > 10)))
----filter(OR[(t1.a < 2),(t1.a > 10)])
------PhysicalOlapScan[extend_infer_t3]
----PhysicalOlapScan[extend_infer_t4]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ PhysicalResultSink
----hashAgg[GLOBAL]
------hashAgg[LOCAL]
--------PhysicalUnion
----------filter((a IN (1, 2) OR b IN ('2d', '3')))
----------filter(OR[a IN (1, 2),b IN ('2d', '3')])
------------PhysicalOlapScan[test_pull_up_predicate_set_op1]
----PhysicalOlapScan[test_pull_up_predicate_set_op3]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ PhysicalResultSink

-- !infer_predicate_full_outer_join --
PhysicalResultSink
--filter(((t1.name = 'Test') OR (t2.name = 'Test')))
--filter(OR[(t1.name = 'Test'),(t2.name = 'Test')])
----hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=()
------PhysicalOlapScan[t]
------PhysicalOlapScan[t]
Expand Down Expand Up @@ -128,8 +128,8 @@ PhysicalResultSink

-- !infer_predicate_complex_and_or_logic --
PhysicalResultSink
--hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=(((t1.score > 80) OR ((t2.name = 'Dave') AND (t1.id < 50))))
----filter(((t1.score > 80) OR (t1.id < 50)))
--hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=(OR[(t1.score > 80),AND[(t2.name = 'Dave'),(t1.id < 50)]])
----filter(OR[(t1.score > 80),(t1.id < 50)])
------PhysicalOlapScan[t]
----PhysicalOlapScan[t]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !left_semi --
PhysicalResultSink
--hashJoin[LEFT_SEMI_JOIN] hashCondition=((t1.b = t2.b)) otherCondition=((((t2.a = 9) AND (t1.a = 1)) OR ((t1.a = 2) AND (t2.a = 8))))
--hashJoin[LEFT_SEMI_JOIN] hashCondition=((t1.b = t2.b)) otherCondition=(OR[AND[(t2.a = 9),(t1.a = 1)],AND[(t1.a = 2),(t2.a = 8)]])
----filter(a IN (1, 2))
------PhysicalOlapScan[extract_from_disjunction_in_join_t1]
----filter(a IN (8, 9))
------PhysicalOlapScan[extract_from_disjunction_in_join_t2]

-- !right_semi --
PhysicalResultSink
--hashJoin[RIGHT_SEMI_JOIN] hashCondition=((t1.b = t2.b)) otherCondition=((((t2.a = 9) AND (t1.a = 1)) OR ((t1.a = 2) AND (t2.a = 8))))
--hashJoin[RIGHT_SEMI_JOIN] hashCondition=((t1.b = t2.b)) otherCondition=(OR[AND[(t2.a = 9),(t1.a = 1)],AND[(t1.a = 2),(t2.a = 8)]])
----filter(a IN (1, 2))
------PhysicalOlapScan[extract_from_disjunction_in_join_t1]
----filter(a IN (8, 9))
------PhysicalOlapScan[extract_from_disjunction_in_join_t2]

-- !left --
PhysicalResultSink
--hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.b = t2.b)) otherCondition=((((t2.a = 9) AND (t1.a = 1)) OR ((t1.a = 2) AND (t2.a = 8))) and a IN (1, 2))
--hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.b = t2.b)) otherCondition=(OR[AND[(t2.a = 9),(t1.a = 1)],AND[(t1.a = 2),(t2.a = 8)]] and a IN (1, 2))
----PhysicalOlapScan[extract_from_disjunction_in_join_t1]
----filter(a IN (8, 9))
------PhysicalOlapScan[extract_from_disjunction_in_join_t2]

-- !right --
PhysicalResultSink
--hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.b = t2.b)) otherCondition=((((t2.a = 9) AND (t1.a = 1)) OR ((t1.a = 2) AND (t2.a = 8))) and a IN (8, 9))
--hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.b = t2.b)) otherCondition=(OR[AND[(t2.a = 9),(t1.a = 1)],AND[(t1.a = 2),(t2.a = 8)]] and a IN (8, 9))
----filter(a IN (1, 2))
------PhysicalOlapScan[extract_from_disjunction_in_join_t1]
----PhysicalOlapScan[extract_from_disjunction_in_join_t2]

-- !left_anti --
PhysicalResultSink
--hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.b = t2.b)) otherCondition=((((t2.a = 9) AND (t1.a = 1)) OR ((t1.a = 2) AND (t2.a = 8))) and a IN (1, 2))
--hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.b = t2.b)) otherCondition=(OR[AND[(t2.a = 9),(t1.a = 1)],AND[(t1.a = 2),(t2.a = 8)]] and a IN (1, 2))
----PhysicalOlapScan[extract_from_disjunction_in_join_t1]
----filter(a IN (8, 9))
------PhysicalOlapScan[extract_from_disjunction_in_join_t2]

-- !right_anti --
PhysicalResultSink
--hashJoin[RIGHT_ANTI_JOIN] hashCondition=((t1.b = t2.b)) otherCondition=((((t2.a = 9) AND (t1.a = 1)) OR ((t1.a = 2) AND (t2.a = 8))) and a IN (8, 9))
--hashJoin[RIGHT_ANTI_JOIN] hashCondition=((t1.b = t2.b)) otherCondition=(OR[AND[(t2.a = 9),(t1.a = 1)],AND[(t1.a = 2),(t2.a = 8)]] and a IN (8, 9))
----filter(a IN (1, 2))
------PhysicalOlapScan[extract_from_disjunction_in_join_t1]
----PhysicalOlapScan[extract_from_disjunction_in_join_t2]

-- !inner --
PhysicalResultSink
--hashJoin[INNER_JOIN] hashCondition=((t1.b = t2.b)) otherCondition=((((t2.a = 9) AND (t1.a = 1)) OR ((t1.a = 2) AND (t2.a = 8))))
--hashJoin[INNER_JOIN] hashCondition=((t1.b = t2.b)) otherCondition=(OR[AND[(t2.a = 9),(t1.a = 1)],AND[(t1.a = 2),(t2.a = 8)]])
----filter(a IN (1, 2))
------PhysicalOlapScan[extract_from_disjunction_in_join_t1]
----filter(a IN (8, 9))
------PhysicalOlapScan[extract_from_disjunction_in_join_t2]

-- !outer --
PhysicalResultSink
--hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.b = t2.b)) otherCondition=((((t2.a = 9) AND (t1.a = 1)) OR ((t1.a = 2) AND (t2.a = 8))) and a IN (1, 2))
--hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.b = t2.b)) otherCondition=(OR[AND[(t2.a = 9),(t1.a = 1)],AND[(t1.a = 2),(t2.a = 8)]] and a IN (1, 2))
----filter((t1.c = 3))
------PhysicalOlapScan[extract_from_disjunction_in_join_t1]
----filter(a IN (8, 9))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ PhysicalResultSink
------PhysicalQuickSort[LOCAL_SORT]
--------PhysicalPartitionTopN
----------PhysicalProject
------------filter(((t.id > 1) OR (t.value1 > 2)))
------------filter(OR[(t.id > 1),(t.value1 > 2)])
--------------PhysicalOlapScan[push_down_multi_column_predicate_through_window_t]

-- !multi_column_or_predicate_push_down_window --
Expand Down
Loading

0 comments on commit 9fef1dc

Please sign in to comment.