This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git

commit db65114f77dbffc1ce3b3803015d9e5b30ae310d
Author: LiBinfeng <46676950+libinfeng...@users.noreply.github.com>
AuthorDate: Thu Mar 7 13:57:21 2024 +0800

    [Fix](Nereids) fix hint cases with random result (#31865)
---
 .../data/nereids_p0/hint/test_distribute.out       |   2 +-
 .../data/nereids_p0/hint/test_leading.out          | 146 +--------------------
 .../suites/nereids_p0/hint/test_distribute.groovy  |   2 +-
 .../suites/nereids_p0/hint/test_leading.groovy     |  14 +-
 4 files changed, 16 insertions(+), 148 deletions(-)

diff --git a/regression-test/data/nereids_p0/hint/test_distribute.out 
b/regression-test/data/nereids_p0/hint/test_distribute.out
index 5fae729afe6..a14b6696a8d 100644
--- a/regression-test/data/nereids_p0/hint/test_distribute.out
+++ b/regression-test/data/nereids_p0/hint/test_distribute.out
@@ -442,7 +442,7 @@ PhysicalResultSink
 ----------------------PhysicalOlapScan[t2]
 
 Hint log:
-Used:
+Used: leading(t3 { t1 t2 } )
 UnUsed: [shuffle]_2
 SyntaxError:
 
diff --git a/regression-test/data/nereids_p0/hint/test_leading.out 
b/regression-test/data/nereids_p0/hint/test_leading.out
index 2c0ddc63142..7274d409312 100644
--- a/regression-test/data/nereids_p0/hint/test_leading.out
+++ b/regression-test/data/nereids_p0/hint/test_leading.out
@@ -1815,157 +1815,25 @@
 119
 
 -- !select70_1 --
-PhysicalResultSink
---hashAgg[GLOBAL]
-----PhysicalDistribute[DistributionSpecGather]
-------hashAgg[LOCAL]
---------PhysicalProject
-----------hashJoin[INNER_JOIN] hashCondition=((t1.c1 = t2.c2)) 
otherCondition=()
-------------PhysicalProject
---------------PhysicalOlapScan[t1]
-------------PhysicalDistribute[DistributionSpecHash]
---------------PhysicalProject
-----------------PhysicalOlapScan[t2]
-
-Hint log:
-Used:
-UnUsed:
-SyntaxError: leading(t1 t3) Msg:can not find table: t3
+1719
 
 -- !select70_2 --
-PhysicalResultSink
---hashAgg[GLOBAL]
-----PhysicalDistribute[DistributionSpecGather]
-------hashAgg[LOCAL]
---------PhysicalProject
-----------hashJoin[INNER_JOIN] hashCondition=((t1.c1 = t2.c2)) 
otherCondition=()
-------------PhysicalProject
---------------PhysicalOlapScan[t1]
-------------PhysicalDistribute[DistributionSpecHash]
---------------PhysicalProject
-----------------PhysicalOlapScan[t2]
-
-Hint log:
-Used:
-UnUsed:
-SyntaxError: leading(t1 t5) Msg:can not find table: t5
+1719
 
 -- !select71_1 --
-PhysicalResultSink
---hashAgg[GLOBAL]
-----PhysicalDistribute[DistributionSpecGather]
-------hashAgg[LOCAL]
---------PhysicalProject
-----------hashJoin[INNER_JOIN] hashCondition=((t1.c1 = t2.c2)) 
otherCondition=()
-------------PhysicalProject
---------------PhysicalOlapScan[t1]
-------------PhysicalDistribute[DistributionSpecHash]
---------------PhysicalProject
-----------------PhysicalOlapScan[t2]
-
-Hint log:
-Used:
-UnUsed:
-SyntaxError: leading(t1 t1 t2) Msg:duplicated table
+1719
 
 -- !select71_2 --
-PhysicalResultSink
---hashAgg[GLOBAL]
-----PhysicalDistribute[DistributionSpecGather]
-------hashAgg[LOCAL]
---------PhysicalProject
-----------hashJoin[INNER_JOIN] hashCondition=((t1.c1 = t2.c2)) 
otherCondition=()
-------------PhysicalProject
---------------PhysicalOlapScan[t1]
-------------PhysicalDistribute[DistributionSpecHash]
---------------PhysicalProject
-----------------PhysicalOlapScan[t2]
-
-Hint log:
-Used:
-UnUsed:
-SyntaxError: leading(t1 t2 t2) Msg:duplicated table
+1719
 
 -- !select72_1 --
-PhysicalResultSink
---hashAgg[GLOBAL]
-----PhysicalDistribute[DistributionSpecGather]
-------hashAgg[LOCAL]
---------PhysicalProject
-----------hashJoin[INNER_JOIN] hashCondition=((t1.c1 = t2.c2)) 
otherCondition=()
-------------PhysicalProject
---------------PhysicalOlapScan[t1]
-------------PhysicalDistribute[DistributionSpecHash]
---------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((t2.c2 = t3.c3)) 
otherCondition=()
-----------------PhysicalProject
-------------------PhysicalOlapScan[t2]
-----------------PhysicalDistribute[DistributionSpecHash]
-------------------PhysicalProject
---------------------hashJoin[INNER_JOIN] hashCondition=((t3.c3 = t4.c4)) 
otherCondition=()
-----------------------PhysicalProject
-------------------------PhysicalOlapScan[t4]
-----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------PhysicalProject
---------------------------PhysicalOlapScan[t3]
-
-Hint log:
-Used: leading(t4 t3 )
-UnUsed:
-SyntaxError:
+1235
 
 -- !select72_2 --
-PhysicalResultSink
---hashAgg[GLOBAL]
-----PhysicalDistribute[DistributionSpecGather]
-------hashAgg[LOCAL]
---------PhysicalProject
-----------hashJoin[LEFT_SEMI_JOIN] hashCondition=((t2.c2 = t3.c3)) 
otherCondition=()
-------------hashJoin[INNER_JOIN] hashCondition=((t1.c1 = t2.c2)) 
otherCondition=()
---------------PhysicalProject
-----------------PhysicalOlapScan[t1]
---------------PhysicalDistribute[DistributionSpecHash]
-----------------PhysicalProject
-------------------PhysicalOlapScan[t2]
-------------PhysicalDistribute[DistributionSpecHash]
---------------PhysicalProject
-----------------hashJoin[INNER_JOIN] hashCondition=((t3.c3 = t4.c4)) 
otherCondition=()
-------------------PhysicalProject
---------------------PhysicalOlapScan[t3]
-------------------PhysicalDistribute[DistributionSpecHash]
---------------------PhysicalProject
-----------------------PhysicalOlapScan[t4]
-
-Hint log:
-Used: leading(t1 t2 )
-UnUsed:
-SyntaxError:
+1235
 
 -- !select73_1 --
-PhysicalResultSink
---hashAgg[GLOBAL]
-----PhysicalDistribute[DistributionSpecGather]
-------hashAgg[LOCAL]
---------PhysicalProject
-----------hashJoin[LEFT_SEMI_JOIN] hashCondition=((t2.c2 = t3.c3)) 
otherCondition=()
-------------hashJoin[INNER_JOIN] hashCondition=((t1.c1 = t2.c2)) 
otherCondition=()
---------------PhysicalProject
-----------------PhysicalOlapScan[t1]
---------------PhysicalDistribute[DistributionSpecHash]
-----------------PhysicalProject
-------------------PhysicalOlapScan[t2]
-------------PhysicalDistribute[DistributionSpecHash]
---------------PhysicalProject
-----------------hashJoin[INNER_JOIN] hashCondition=((t3.c3 = t4.c4)) 
otherCondition=()
-------------------PhysicalProject
---------------------PhysicalOlapScan[t4]
-------------------PhysicalDistribute[DistributionSpecHash]
---------------------PhysicalProject
-----------------------PhysicalOlapScan[t3]
-
-Hint log:
-Used: leading(t1 t2 ) leading(t4 t3 )
-UnUsed:
-SyntaxError:
+1235
 
 -- !select81_1 --
 259
diff --git a/regression-test/suites/nereids_p0/hint/test_distribute.groovy 
b/regression-test/suites/nereids_p0/hint/test_distribute.groovy
index a8b4c308d44..6ac7faa1ec0 100644
--- a/regression-test/suites/nereids_p0/hint/test_distribute.groovy
+++ b/regression-test/suites/nereids_p0/hint/test_distribute.groovy
@@ -104,7 +104,7 @@ suite("test_distribute") {
     qt_select5_1 """explain shape plan select count(*) from t1 join [shuffle] 
t2 on c1 > c2;"""
     qt_select5_2 """explain shape plan select count(*) from t1 join 
[broadcast] t2 on c1 > c2;"""
 
-    qt_select6_1 """explain shape plan select count(*) from t1 join [shuffle] 
t2 on c1 > c2 join t3 on c2 > c3 where c1 < 100;"""
+    qt_select6_1 """explain shape plan select /*+ leading(t3 {t1 t2}) */ 
count(*) from t1 join [shuffle] t2 on c1 > c2 join t3 on c2 > c3 where c1 < 
100;"""
     qt_select6_2 """explain shape plan select count(*) from t1 join t2 on c1 > 
c2 join t3 on c2 > c3 where c1 < 100;"""
 
     // (A leftjoin B on (Pab)) leftjoin C on (Pac) = (A leftjoin C on (Pac)) 
leftjoin B on (Pab)
diff --git a/regression-test/suites/nereids_p0/hint/test_leading.groovy 
b/regression-test/suites/nereids_p0/hint/test_leading.groovy
index fd1abbc526c..50771186c64 100644
--- a/regression-test/suites/nereids_p0/hint/test_leading.groovy
+++ b/regression-test/suites/nereids_p0/hint/test_leading.groovy
@@ -794,19 +794,19 @@ suite("test_leading") {
     qt_select68_13 """select /*+ leading(t3 {t2 t1}) */ count(*) from t1 left 
semi join t2 on c1 = c2 left anti join t3 on c1 = c3 where exists (select 1 
from t3 join t4 on c3 = c4);"""
 
     // wrong table name
-    qt_select70_1 """explain shape plan select /*+ leading(t1 t3) */ count(*) 
from t1 join t2 on c1 = c2;"""
-    qt_select70_2 """explain shape plan select /*+ leading(t1 t5) */ count(*) 
from t1 join t2 on c1 = c2;"""
+    qt_select70_1 """select /*+ leading(t1 t3) */ count(*) from t1 join t2 on 
c1 = c2;"""
+    qt_select70_2 """select /*+ leading(t1 t5) */ count(*) from t1 join t2 on 
c1 = c2;"""
 
     // duplicate table name
-    qt_select71_1 """explain shape plan select /*+ leading(t1 t1 t2) */ 
count(*) from t1 join t2 on c1 = c2;"""
-    qt_select71_2 """explain shape plan select /*+ leading(t1 t2 t2) */ 
count(*) from t1 join t2 on c1 = c2;"""
+    qt_select71_1 """select /*+ leading(t1 t1 t2) */ count(*) from t1 join t2 
on c1 = c2;"""
+    qt_select71_2 """select /*+ leading(t1 t2 t2) */ count(*) from t1 join t2 
on c1 = c2;"""
 
     // different scope
-    qt_select72_1 """explain shape plan select count(*) from t1 join t2 on c1 
= c2 where c2 in (select /*+ leading(t4 t3) */ c3 from t3 join t4 on c3 = 
c4);"""
-    qt_select72_2 """explain shape plan select /*+ leading(t1 t2) */ count(*) 
from t1 join t2 on c1 = c2 where c2 in (select c3 from t3 join t4 on c3 = 
c4);"""
+    qt_select72_1 """select count(*) from t1 join t2 on c1 = c2 where c2 in 
(select /*+ leading(t4 t3) */ c3 from t3 join t4 on c3 = c4);"""
+    qt_select72_2 """select /*+ leading(t1 t2) */ count(*) from t1 join t2 on 
c1 = c2 where c2 in (select c3 from t3 join t4 on c3 = c4);"""
 
     // multi leading hint
-    qt_select73_1 """explain shape plan select /*+ leading(t1 t2) */ count(*) 
from t1 join t2 on c1 = c2 where c2 in (select /*+ leading(t4 t3) */ c3 from t3 
join t4 on c3 = c4);"""
+    qt_select73_1 """select /*+ leading(t1 t2) */ count(*) from t1 join t2 on 
c1 = c2 where c2 in (select /*+ leading(t4 t3) */ c3 from t3 join t4 on c3 = 
c4);"""
 
     // alias
 // inner join + anti join


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to