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
77 changes: 29 additions & 48 deletions regression-test/data/nereids_p0/hint/fix_leading.out
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select1 --
PhysicalResultSink
--PhysicalDistribute
----PhysicalProject
------hashJoin[INNER_JOIN](t1.c1 = t3.c3)(t1.c1 = t4.c4)
--------NestedLoopJoin[CROSS_JOIN]
----------PhysicalOlapScan[t1]
----------PhysicalDistribute
------------filter((t2.c2 = t2.c2))
--------------PhysicalOlapScan[t2]
--------PhysicalDistribute
----------NestedLoopJoin[CROSS_JOIN](t4.c4 = t3.c3)(t3.c3 = t4.c4)
------------PhysicalOlapScan[t3]
------------PhysicalDistribute
--------------PhysicalOlapScan[t4]
--hashJoin[INNER_JOIN](t1.c1 = t3.c3)(t1.c1 = t4.c4)
----NestedLoopJoin[CROSS_JOIN]
------PhysicalOlapScan[t1]
------filter((t2.c2 = t2.c2))
--------PhysicalOlapScan[t2]
----NestedLoopJoin[CROSS_JOIN](t4.c4 = t3.c3)(t3.c3 = t4.c4)
------PhysicalOlapScan[t3]
------PhysicalOlapScan[t4]

Hint log:
Used: leading({ t1 t2 } { t3 t4 } )
UnUsed:
UnUsed:
SyntaxError:

-- !select2_1_1 --
Expand Down Expand Up @@ -231,50 +226,36 @@ SyntaxError:
PhysicalResultSink
--hashAgg[GLOBAL]
----hashAgg[LOCAL]
------PhysicalProject
--------NestedLoopJoin[RIGHT_OUTER_JOIN](t3.c3 > 500)
----------PhysicalDistribute[DistributionSpecGather]
------------PhysicalProject
--------------NestedLoopJoin[LEFT_OUTER_JOIN](t1.c1 < 200)(t1.c1 > 500)
----------------PhysicalProject
------------------PhysicalOlapScan[t1]
----------------PhysicalDistribute[DistributionSpecReplicated]
------------------PhysicalProject
--------------------filter((t2.c2 > 500))
----------------------PhysicalOlapScan[t2]
----------PhysicalDistribute[DistributionSpecGather]
------------PhysicalProject
--------------PhysicalOlapScan[t3]
------NestedLoopJoin[RIGHT_OUTER_JOIN](t3.c3 > 500)
--------NestedLoopJoin[LEFT_OUTER_JOIN](t1.c1 < 200)(t1.c1 > 500)
----------PhysicalOlapScan[t1]
----------filter((t2.c2 > 500))
------------PhysicalOlapScan[t2]
--------PhysicalOlapScan[t3]

Hint log:
Used: leading(t1 t2 t3 )
UnUsed:
UnUsed:
SyntaxError:

-- !select6_1 --
PhysicalResultSink
--hashAgg[GLOBAL]
----PhysicalDistribute[DistributionSpecGather]
------hashAgg[LOCAL]
--------hashJoin[INNER_JOIN] hashCondition=((t1.c1 = t6.c6)) otherCondition=()
----------hashJoin[INNER_JOIN] hashCondition=((t1.c1 = t2.c2) and (t1.c1 = t3.c3) and (t1.c1 = t4.c4) and (t1.c1 = t5.c5)) otherCondition=()
------------PhysicalOlapScan[t1]
------------PhysicalDistribute[DistributionSpecHash]
--------------hashJoin[INNER_JOIN] hashCondition=((t2.c2 = t4.c4) and (t2.c2 = t5.c5) and (t3.c3 = t4.c4) and (t3.c3 = t5.c5)) otherCondition=()
----------------hashJoin[INNER_JOIN] hashCondition=((t2.c2 = t3.c3)) otherCondition=()
------------------PhysicalOlapScan[t2]
------------------PhysicalDistribute[DistributionSpecHash]
--------------------PhysicalOlapScan[t3]
----------------PhysicalDistribute[DistributionSpecHash]
------------------hashJoin[INNER_JOIN] hashCondition=((t4.c4 = t5.c5)) otherCondition=()
--------------------PhysicalOlapScan[t4]
--------------------PhysicalDistribute[DistributionSpecHash]
----------------------PhysicalOlapScan[t5]
----------PhysicalDistribute[DistributionSpecHash]
------------PhysicalOlapScan[t6]
----hashAgg[LOCAL]
------hashJoin[INNER_JOIN](t1.c1 = t6.c6)
--------hashJoin[INNER_JOIN](t1.c1 = t2.c2)(t1.c1 = t3.c3)(t1.c1 = t4.c4)(t1.c1 = t5.c5)
----------PhysicalOlapScan[t1]
----------NestedLoopJoin[CROSS_JOIN](t3.c3 = t5.c5)(t2.c2 = t4.c4)(t2.c2 = t5.c5)(t5.c5 = t2.c2)(t4.c4 = t2.c2)(t5.c5 = t3.c3)(t4.c4 = t3.c3)(t3.c3 = t4.c4)
------------NestedLoopJoin[CROSS_JOIN](t3.c3 = t2.c2)(t2.c2 = t3.c3)
--------------PhysicalOlapScan[t2]
--------------PhysicalOlapScan[t3]
------------NestedLoopJoin[CROSS_JOIN](t5.c5 = t4.c4)(t4.c4 = t5.c5)
--------------PhysicalOlapScan[t4]
--------------PhysicalOlapScan[t5]
--------PhysicalOlapScan[t6]

Hint log:
Used: leading(t1 { { t2 t3 } { t4 t5 } } t6 )
UnUsed:
UnUsed:
SyntaxError:

7 changes: 2 additions & 5 deletions regression-test/suites/nereids_p0/hint/fix_leading.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ suite("fix_leading") {
sql 'set enable_nereids_planner=true'
sql 'set enable_fallback_to_original_planner=false'
sql 'set runtime_filter_mode=OFF'
sql "set ignore_shape_nodes='PhysicalProject'"
sql "set ignore_shape_nodes='PhysicalProject, PhysicalDistribute'"


// create tables
Expand Down Expand Up @@ -197,15 +197,12 @@ suite("fix_leading") {
// check whether we have all tables
explain {
sql """shape plan select /*+ leading(t1 t2)*/ count(*) from t1 left join t2 on c1 > 500 and c2 >500 right join t3 on c3 > 500 and c1 < 200;"""
contains("SyntaxError: leading(t1 t2) Msg:leading should have all tables in query block, missing tables: t3")
contains("SyntaxError: leading(t1 t2 ) Msg:leading should have all tables in query block, missing tables: t3")
}

// check brace problem
qt_select6_1 """explain shape plan select /*+ leading(t1 {{t2 t3}{t4 t5}} t6) */ count(*) from t1 join t2 on c1 = c2 join t3 on c1 = c3 join t4 on c1 = c4 join t5 on c1 = c5 join t6 on c1 = c6;"""

// check brace problem
qt_select6_1 """explain shape plan select /*+ leading(t1 {{t2 t3}{t4 t5}} t6) */ count(*) from t1 join t2 on c1 = c2 join t3 on c1 = c3 join t4 on c1 = c4 join t5 on c1 = c5 join t6 on c1 = c6;"""

// check filter in duplicated aliasName
explain {
sql """shape plan SELECT
Expand Down