forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[test](Nereids): add regression test eliminate/infer rules (apache#27985
- Loading branch information
Showing
7 changed files
with
1,108 additions
and
1 deletion.
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
70 changes: 70 additions & 0 deletions
70
regression-test/data/nereids_rules_p0/eliminate_not_null/eliminate_not_null.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,70 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !eliminate_not_null_basic_comparison -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----filter(( not score IS NULL) and (t.score > 13)) | ||
------PhysicalOlapScan[t] | ||
|
||
-- !eliminate_not_null_in_clause -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----filter(( not id IS NULL) and id IN (1, 2, 3)) | ||
------PhysicalOlapScan[t] | ||
|
||
-- !eliminate_not_null_not_equal -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----filter(( not (score = 13)) and ( not score IS NULL)) | ||
------PhysicalOlapScan[t] | ||
|
||
-- !eliminate_not_null_string_function -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----filter(( not name IS NULL) and (length(name) > 0)) | ||
------PhysicalOlapScan[t] | ||
|
||
-- !eliminate_not_null_aggregate -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashAgg[LOCAL] | ||
--------PhysicalProject | ||
----------filter(( not score IS NULL) and (t.score > 0)) | ||
------------PhysicalOlapScan[t] | ||
|
||
-- !eliminate_not_null_between -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----filter(( not score IS NULL) and (t.score <= 10) and (t.score >= 1)) | ||
------PhysicalOlapScan[t] | ||
|
||
-- !eliminate_not_null_math_function -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----filter(( not score IS NULL) and (abs(score) = 5)) | ||
------PhysicalOlapScan[t] | ||
|
||
-- !eliminate_not_null_complex_logic -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----filter(( not score IS NULL) and ((t.score > 5) OR (t.id < 10))) | ||
------PhysicalOlapScan[t] | ||
|
||
-- !eliminate_not_null_date_function -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----filter(( not name IS NULL) and (year(cast(name as DATEV2)) = 2022)) | ||
------PhysicalOlapScan[t] | ||
|
||
-- !eliminate_not_null_with_subquery -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[LEFT_SEMI_JOIN] hashCondition=((t.score = t.score)) otherCondition=() build RFs:RF0 score->[score] | ||
--------filter(( not score IS NULL) and (t.score > 0)) | ||
----------PhysicalOlapScan[t] apply RFs: RF0 | ||
--------PhysicalDistribute | ||
----------PhysicalProject | ||
------------filter((t.score > 0)) | ||
--------------PhysicalOlapScan[t] | ||
|
303 changes: 303 additions & 0 deletions
303
regression-test/data/nereids_rules_p0/eliminate_outer_join/eliminate_outer_join.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,303 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !left_outer -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
--------PhysicalOlapScan[t] apply RFs: RF0 | ||
--------filter((t2.score > 10)) | ||
----------PhysicalOlapScan[t] | ||
|
||
-- !right_outer -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
--------PhysicalOlapScan[t] apply RFs: RF0 | ||
--------filter((t1.score > 10)) | ||
----------PhysicalOlapScan[t] | ||
|
||
-- !full_outer_join -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
--------PhysicalOlapScan[t] apply RFs: RF0 | ||
--------filter((t1.score > 10)) | ||
----------PhysicalOlapScan[t] | ||
|
||
-- !full_outer_join -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
--------PhysicalOlapScan[t] apply RFs: RF0 | ||
--------filter((t2.score > 10)) | ||
----------PhysicalOlapScan[t] | ||
|
||
-- !full_outer_join -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
--------filter((t1.score > 10)) | ||
----------PhysicalOlapScan[t] apply RFs: RF0 | ||
--------filter((t2.score > 10)) | ||
----------PhysicalOlapScan[t] | ||
|
||
-- !left_outer -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
--------filter((t1.score > 10)) | ||
----------PhysicalOlapScan[t] apply RFs: RF0 | ||
--------filter((t2.score > 10)) | ||
----------PhysicalOlapScan[t] | ||
|
||
-- !multiple_left_outer_1 -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=() | ||
--------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
----------PhysicalOlapScan[t] apply RFs: RF0 | ||
----------filter((t1.score > 10)) | ||
------------PhysicalOlapScan[t] | ||
--------PhysicalOlapScan[t] | ||
|
||
-- !multiple_left_outer_2 -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=() | ||
--------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
----------PhysicalOlapScan[t] apply RFs: RF0 | ||
----------filter((t2.score > 10)) | ||
------------PhysicalOlapScan[t] | ||
--------PhysicalOlapScan[t] | ||
|
||
-- !multiple_right_outer_1 -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[INNER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=() build RFs:RF1 id->[id] | ||
--------PhysicalOlapScan[t] apply RFs: RF1 | ||
--------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
----------PhysicalOlapScan[t] apply RFs: RF0 | ||
----------filter((t1.score > 10)) | ||
------------PhysicalOlapScan[t] | ||
|
||
-- !multiple_right_outer_2 -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[INNER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=() build RFs:RF1 id->[id] | ||
--------PhysicalOlapScan[t] apply RFs: RF1 | ||
--------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
----------PhysicalOlapScan[t] apply RFs: RF0 | ||
----------filter((t2.score > 10)) | ||
------------PhysicalOlapScan[t] | ||
|
||
-- !multiple_full_outer_1 -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=() | ||
--------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
----------PhysicalOlapScan[t] apply RFs: RF0 | ||
----------filter((t1.score > 10)) | ||
------------PhysicalOlapScan[t] | ||
--------PhysicalOlapScan[t] | ||
|
||
-- !multiple_full_outer_2 -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=() | ||
--------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
----------PhysicalOlapScan[t] apply RFs: RF0 | ||
----------filter((t2.score > 10)) | ||
------------PhysicalOlapScan[t] | ||
--------PhysicalDistribute | ||
----------PhysicalOlapScan[t] | ||
|
||
-- !left_outer_join_non_null_assertion -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
--------PhysicalOlapScan[t] apply RFs: RF0 | ||
--------filter(( not id IS NULL) and (t1.score > 5)) | ||
----------PhysicalOlapScan[t] | ||
|
||
-- !right_outer_join_non_null_assertion -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
--------PhysicalOlapScan[t] apply RFs: RF0 | ||
--------filter(( not id IS NULL) and (t2.score > 5)) | ||
----------PhysicalOlapScan[t] | ||
|
||
-- !full_outer_join_compound_conditions -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------filter(((t1.score > 5) OR (t2.score > 5))) | ||
--------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() | ||
----------PhysicalOlapScan[t] | ||
----------PhysicalOlapScan[t] | ||
|
||
-- !multiple_joins_complex_conditions -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[INNER_JOIN] hashCondition=((t2.id = t3.id)) otherCondition=() build RFs:RF1 id->[id] | ||
--------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
----------PhysicalOlapScan[t] apply RFs: RF0 RF1 | ||
----------filter((t1.score > 5)) | ||
------------PhysicalOlapScan[t] | ||
--------filter(( not score IS NULL)) | ||
----------PhysicalOlapScan[t] | ||
|
||
-- !using_non_equijoin_conditions -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[LEFT_OUTER_JOIN] hashCondition=((expr_cast(score as BIGINT) = expr_(score + 10))) otherCondition=() | ||
--------PhysicalProject | ||
----------filter(( not id IS NULL)) | ||
------------PhysicalOlapScan[t] | ||
--------PhysicalDistribute | ||
----------PhysicalProject | ||
------------PhysicalOlapScan[t] | ||
|
||
-- !joining_multiple_tables_with_aggregate_functions -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------filter((count(id) > 1)) | ||
--------hashAgg[LOCAL] | ||
----------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() | ||
------------PhysicalProject | ||
--------------PhysicalOlapScan[t] | ||
------------PhysicalProject | ||
--------------PhysicalOlapScan[t] | ||
|
||
-- !using_subqueries -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() | ||
--------filter(( not id IS NULL)) | ||
----------PhysicalOlapScan[t] | ||
--------PhysicalProject | ||
----------PhysicalOlapScan[t] | ||
|
||
-- !left_outer -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
--------filter(( not name IS NULL)) | ||
----------PhysicalOlapScan[t] apply RFs: RF0 | ||
--------filter((t1.score > 10)) | ||
----------PhysicalOlapScan[t] | ||
|
||
-- !right_outer -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
--------filter(( not name IS NULL)) | ||
----------PhysicalOlapScan[t] apply RFs: RF0 | ||
--------filter((t1.score > 10)) | ||
----------PhysicalOlapScan[t] | ||
|
||
-- !full_outer -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
--------filter(( not name IS NULL)) | ||
----------PhysicalOlapScan[t] apply RFs: RF0 | ||
--------filter((t1.score > 10)) | ||
----------PhysicalOlapScan[t] | ||
|
||
-- !self_left_outer -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[INNER_JOIN] hashCondition=((t1.id = t1_alias.id)) otherCondition=() build RFs:RF0 id->[id] | ||
--------PhysicalOlapScan[t] apply RFs: RF0 | ||
--------filter((t1_alias.name > '2023-01-01')) | ||
----------PhysicalOlapScan[t] | ||
|
||
-- !right_outer_aggregate -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----hashAgg[LOCAL] | ||
------PhysicalProject | ||
--------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() | ||
----------PhysicalProject | ||
------------PhysicalOlapScan[t] | ||
----------PhysicalProject | ||
------------PhysicalOlapScan[t] | ||
|
||
-- !full_outer_multiple_tables -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------filter(name IS NULL) | ||
--------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=() | ||
----------PhysicalDistribute | ||
------------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() | ||
--------------PhysicalOlapScan[t] | ||
--------------PhysicalOlapScan[t] | ||
----------PhysicalDistribute | ||
------------PhysicalOlapScan[t] | ||
|
||
-- !left_outer_with_subquery -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
--------PhysicalOlapScan[t] apply RFs: RF0 | ||
--------PhysicalProject | ||
----------filter((t2.score > 20)) | ||
------------PhysicalOlapScan[t] | ||
|
||
-- !complex_join_conditions -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[INNER_JOIN] hashCondition=((expr_cast(score as BIGINT) = expr_(score * 2))) otherCondition=((t1.id < t2.id)) | ||
--------PhysicalProject | ||
----------PhysicalOlapScan[t] | ||
--------PhysicalDistribute | ||
----------PhysicalProject | ||
------------PhysicalOlapScan[t] | ||
|
||
-- !multiple_outer_with_window_function -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------PhysicalWindow | ||
--------PhysicalQuickSort[LOCAL_SORT] | ||
----------PhysicalDistribute | ||
------------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() | ||
--------------PhysicalProject | ||
----------------PhysicalOlapScan[t] | ||
--------------PhysicalProject | ||
----------------PhysicalOlapScan[t] | ||
|
||
-- !join_different_tables_non_null -- | ||
PhysicalResultSink | ||
--PhysicalDistribute | ||
----PhysicalProject | ||
------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() build RFs:RF0 id->[id] | ||
--------PhysicalOlapScan[t] apply RFs: RF0 | ||
--------filter(( not name IS NULL)) | ||
----------PhysicalOlapScan[t] | ||
|
Oops, something went wrong.