Skip to content

Commit

Permalink
[Nereids] add leading tpch
Browse files Browse the repository at this point in the history
  • Loading branch information
LiBinfeng-01 committed Aug 28, 2023
1 parent 2000248 commit 982ca43
Show file tree
Hide file tree
Showing 46 changed files with 2,337 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ public Long getLeadingTableBitmap(List<TableIf> tables) {
this.setErrorMessage("duplicated table");
return totalBitmap;
}
if (getTablelist().size() != tables.size()) {
if (tables != null && getTablelist().size() != tables.size()) {
this.setStatus(HintStatus.SYNTAX_ERROR);
this.setErrorMessage("tables should be same as join tables");
return totalBitmap;
Expand Down
13 changes: 13 additions & 0 deletions regression-test/data/nereids_hint_tpch_p0/shape/q1.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select --
PhysicalResultSink
--PhysicalQuickSort
----PhysicalDistribute
------PhysicalQuickSort
--------hashAgg[GLOBAL]
----------PhysicalDistribute
------------hashAgg[LOCAL]
--------------PhysicalProject
----------------filter((lineitem.l_shipdate <= 1998-09-02))
------------------PhysicalOlapScan[lineitem]

35 changes: 35 additions & 0 deletions regression-test/data/nereids_hint_tpch_p0/shape/q10.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select --
PhysicalResultSink
--PhysicalTopN
----PhysicalDistribute
------PhysicalTopN
--------PhysicalProject
----------hashAgg[GLOBAL]
------------PhysicalDistribute
--------------hashAgg[LOCAL]
----------------PhysicalProject
------------------hashJoin[INNER_JOIN](lineitem.l_orderkey = orders.o_orderkey)
--------------------PhysicalProject
----------------------filter((lineitem.l_returnflag = 'R'))
------------------------PhysicalOlapScan[lineitem]
--------------------PhysicalDistribute
----------------------PhysicalProject
------------------------hashJoin[INNER_JOIN](customer.c_nationkey = nation.n_nationkey)
--------------------------PhysicalDistribute
----------------------------PhysicalProject
------------------------------hashJoin[INNER_JOIN](customer.c_custkey = orders.o_custkey)
--------------------------------PhysicalProject
----------------------------------PhysicalOlapScan[customer]
--------------------------------PhysicalDistribute
----------------------------------PhysicalProject
------------------------------------filter((orders.o_orderdate < 1994-01-01)(orders.o_orderdate >= 1993-10-01))
--------------------------------------PhysicalOlapScan[orders]
--------------------------PhysicalDistribute
----------------------------PhysicalProject
------------------------------PhysicalOlapScan[nation]

Used: leading(lineitem { { customer orders } nation })
UnUsed:
SyntaxError:

40 changes: 40 additions & 0 deletions regression-test/data/nereids_hint_tpch_p0/shape/q11.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select --
PhysicalResultSink
--PhysicalQuickSort
----PhysicalDistribute
------PhysicalQuickSort
--------PhysicalProject
----------NestedLoopJoin[INNER_JOIN](cast(value as DOUBLE) > cast((sum((ps_supplycost * ps_availqty)) * 0.000002) as DOUBLE))
------------hashAgg[LOCAL]
--------------PhysicalProject
----------------hashJoin[INNER_JOIN](partsupp.ps_suppkey = supplier.s_suppkey)
------------------PhysicalProject
--------------------PhysicalOlapScan[partsupp]
------------------PhysicalDistribute
--------------------hashJoin[INNER_JOIN](supplier.s_nationkey = nation.n_nationkey)
----------------------PhysicalProject
------------------------PhysicalOlapScan[supplier]
----------------------PhysicalDistribute
------------------------PhysicalProject
--------------------------filter((nation.n_name = 'GERMANY'))
----------------------------PhysicalOlapScan[nation]
------------PhysicalDistribute
--------------PhysicalAssertNumRows
----------------PhysicalProject
------------------hashAgg[GLOBAL]
--------------------PhysicalDistribute
----------------------hashAgg[LOCAL]
------------------------PhysicalProject
--------------------------hashJoin[INNER_JOIN](partsupp.ps_suppkey = supplier.s_suppkey)
----------------------------PhysicalProject
------------------------------PhysicalOlapScan[partsupp]
----------------------------PhysicalDistribute
------------------------------hashJoin[INNER_JOIN](supplier.s_nationkey = nation.n_nationkey)
--------------------------------PhysicalProject
----------------------------------PhysicalOlapScan[supplier]
--------------------------------PhysicalDistribute
----------------------------------PhysicalProject
------------------------------------filter((nation.n_name = 'GERMANY'))
--------------------------------------PhysicalOlapScan[nation]

20 changes: 20 additions & 0 deletions regression-test/data/nereids_hint_tpch_p0/shape/q12.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select --
PhysicalResultSink
--PhysicalQuickSort
----PhysicalDistribute
------PhysicalQuickSort
--------hashAgg[GLOBAL]
----------PhysicalDistribute
------------hashAgg[LOCAL]
--------------PhysicalProject
----------------hashJoin[INNER_JOIN](orders.o_orderkey = lineitem.l_orderkey)
------------------PhysicalProject
--------------------PhysicalOlapScan[orders]
------------------PhysicalProject
--------------------filter(l_shipmode IN ('MAIL', 'SHIP')(lineitem.l_shipdate < lineitem.l_commitdate)(lineitem.l_receiptdate < 1995-01-01)(lineitem.l_receiptdate >= 1994-01-01)(lineitem.l_commitdate < lineitem.l_receiptdate))
----------------------PhysicalOlapScan[lineitem]

Used: leading(orders lineitem)
UnUsed:
SyntaxError:
25 changes: 25 additions & 0 deletions regression-test/data/nereids_hint_tpch_p0/shape/q13.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select --
PhysicalResultSink
--PhysicalQuickSort
----PhysicalDistribute
------PhysicalQuickSort
--------hashAgg[GLOBAL]
----------PhysicalDistribute
------------hashAgg[LOCAL]
--------------PhysicalProject
----------------hashAgg[LOCAL]
------------------PhysicalProject
--------------------hashJoin[RIGHT_OUTER_JOIN](customer.c_custkey = orders.o_custkey)
----------------------PhysicalDistribute
------------------------PhysicalProject
--------------------------filter(( not (o_comment like '%special%requests%')))
----------------------------PhysicalOlapScan[orders]
----------------------PhysicalDistribute
------------------------PhysicalProject
--------------------------PhysicalOlapScan[customer]

Used: leading(orders customer)
UnUsed:
SyntaxError:

20 changes: 20 additions & 0 deletions regression-test/data/nereids_hint_tpch_p0/shape/q14.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select --
PhysicalResultSink
--PhysicalProject
----hashAgg[GLOBAL]
------PhysicalDistribute
--------hashAgg[LOCAL]
----------PhysicalProject
------------hashJoin[INNER_JOIN](lineitem.l_partkey = part.p_partkey)
--------------PhysicalProject
----------------PhysicalOlapScan[part]
--------------PhysicalDistribute
----------------PhysicalProject
------------------filter((lineitem.l_shipdate < 1995-10-01)(lineitem.l_shipdate >= 1995-09-01))
--------------------PhysicalOlapScan[lineitem]

Used: leading(part lineitem)
UnUsed:
SyntaxError:

31 changes: 31 additions & 0 deletions regression-test/data/nereids_hint_tpch_p0/shape/q15.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select --
PhysicalResultSink
--PhysicalQuickSort
----PhysicalDistribute
------PhysicalQuickSort
--------PhysicalProject
----------hashJoin[INNER_JOIN](supplier.s_suppkey = revenue0.supplier_no)
------------PhysicalProject
--------------PhysicalOlapScan[supplier]
------------PhysicalDistribute
--------------hashJoin[INNER_JOIN](revenue0.total_revenue = max(total_revenue))
----------------hashAgg[GLOBAL]
------------------PhysicalDistribute
--------------------hashAgg[LOCAL]
----------------------PhysicalProject
------------------------filter((lineitem.l_shipdate >= 1996-01-01)(lineitem.l_shipdate < 1996-04-01))
--------------------------PhysicalOlapScan[lineitem]
----------------PhysicalDistribute
------------------PhysicalAssertNumRows
--------------------hashAgg[GLOBAL]
----------------------PhysicalDistribute
------------------------hashAgg[LOCAL]
--------------------------PhysicalProject
----------------------------hashAgg[GLOBAL]
------------------------------PhysicalDistribute
--------------------------------hashAgg[LOCAL]
----------------------------------PhysicalProject
------------------------------------filter((lineitem.l_shipdate >= 1996-01-01)(lineitem.l_shipdate < 1996-04-01))
--------------------------------------PhysicalOlapScan[lineitem]

27 changes: 27 additions & 0 deletions regression-test/data/nereids_hint_tpch_p0/shape/q16.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select --
PhysicalResultSink
--PhysicalQuickSort
----PhysicalDistribute
------PhysicalQuickSort
--------hashAgg[GLOBAL]
----------PhysicalDistribute
------------hashAgg[LOCAL]
--------------hashJoin[LEFT_ANTI_JOIN](partsupp.ps_suppkey = supplier.s_suppkey)
----------------PhysicalDistribute
------------------PhysicalProject
--------------------hashJoin[INNER_JOIN](part.p_partkey = partsupp.ps_partkey)
----------------------PhysicalProject
------------------------PhysicalOlapScan[partsupp]
----------------------PhysicalProject
------------------------filter(( not (p_type like 'MEDIUM POLISHED%'))( not (p_brand = 'Brand#45'))p_size IN (3, 9, 14, 19, 23, 36, 45, 49))
--------------------------PhysicalOlapScan[part]
----------------PhysicalDistribute
------------------PhysicalProject
--------------------filter((s_comment like '%Customer%Complaints%'))
----------------------PhysicalOlapScan[supplier]

Used: leading(partsupp part supplier)
UnUsed:
SyntaxError:

21 changes: 21 additions & 0 deletions regression-test/data/nereids_hint_tpch_p0/shape/q17.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select --
PhysicalResultSink
--PhysicalProject
----hashAgg[GLOBAL]
------PhysicalDistribute
--------hashAgg[LOCAL]
----------PhysicalProject
------------filter((cast(l_quantity as DECIMALV3(38, 5)) < (0.2 * avg(cast(l_quantity as DECIMALV3(17, 4))) OVER(PARTITION BY p_partkey))))
--------------PhysicalWindow
----------------PhysicalQuickSort
------------------PhysicalDistribute
--------------------PhysicalProject
----------------------hashJoin[INNER_JOIN](part.p_partkey = lineitem.l_partkey)
------------------------PhysicalProject
--------------------------PhysicalOlapScan[lineitem]
------------------------PhysicalDistribute
--------------------------PhysicalProject
----------------------------filter((part.p_container = 'MED BOX')(part.p_brand = 'Brand#23'))
------------------------------PhysicalOlapScan[part]

26 changes: 26 additions & 0 deletions regression-test/data/nereids_hint_tpch_p0/shape/q18.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select --
PhysicalResultSink
--PhysicalTopN
----PhysicalDistribute
------PhysicalTopN
--------hashAgg[LOCAL]
----------PhysicalProject
------------hashJoin[INNER_JOIN](orders.o_orderkey = lineitem.l_orderkey)
--------------PhysicalProject
----------------PhysicalOlapScan[lineitem]
--------------PhysicalDistribute
----------------PhysicalProject
------------------hashJoin[INNER_JOIN](customer.c_custkey = orders.o_custkey)
--------------------PhysicalProject
----------------------PhysicalOlapScan[customer]
--------------------PhysicalDistribute
----------------------hashJoin[LEFT_SEMI_JOIN](orders.o_orderkey = lineitem.l_orderkey)
------------------------PhysicalProject
--------------------------PhysicalOlapScan[orders]
------------------------PhysicalProject
--------------------------filter((sum(l_quantity) > 300.00))
----------------------------hashAgg[LOCAL]
------------------------------PhysicalProject
--------------------------------PhysicalOlapScan[lineitem]

21 changes: 21 additions & 0 deletions regression-test/data/nereids_hint_tpch_p0/shape/q19.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select --
PhysicalResultSink
--hashAgg[GLOBAL]
----PhysicalDistribute
------hashAgg[LOCAL]
--------PhysicalProject
----------hashJoin[INNER_JOIN](part.p_partkey = lineitem.l_partkey)((((((part.p_brand = 'Brand#12') AND p_container IN ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG')) AND ((lineitem.l_quantity >= 1.00) AND (lineitem.l_quantity <= 11.00))) AND (part.p_size <= 5)) OR ((((part.p_brand = 'Brand#23') AND p_container IN ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK')) AND ((lineitem.l_quantity >= 10.00) AND (lineitem.l_quantity <= 20.00))) AND (part.p_size <= 10))) OR ((((part.p_brand = 'Brand#34') AND p_container IN ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG')) AND ((lineitem.l_quantity >= 20.00) AND (lineitem.l_quantity <= 30.00))) AND (part.p_size <= 15)))
------------PhysicalDistribute
--------------PhysicalProject
----------------filter(l_shipmode IN ('AIR', 'AIR REG')(lineitem.l_shipinstruct = 'DELIVER IN PERSON')((((lineitem.l_quantity >= 1.00) AND (lineitem.l_quantity <= 11.00)) OR ((lineitem.l_quantity >= 10.00) AND (lineitem.l_quantity <= 20.00))) OR ((lineitem.l_quantity >= 20.00) AND (lineitem.l_quantity <= 30.00))))
------------------PhysicalOlapScan[lineitem]
------------PhysicalDistribute
--------------PhysicalProject
----------------filter((((((part.p_brand = 'Brand#12') AND p_container IN ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG')) AND (part.p_size <= 5)) OR (((part.p_brand = 'Brand#23') AND p_container IN ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK')) AND (part.p_size <= 10))) OR (((part.p_brand = 'Brand#34') AND p_container IN ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG')) AND (part.p_size <= 15)))(part.p_size >= 1))
------------------PhysicalOlapScan[part]

Used: leading(lineitem part)
UnUsed:
SyntaxError:

34 changes: 34 additions & 0 deletions regression-test/data/nereids_hint_tpch_p0/shape/q2.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select --
PhysicalResultSink
--PhysicalTopN
----PhysicalDistribute
------PhysicalTopN
--------PhysicalProject
----------filter((partsupp.ps_supplycost = min(ps_supplycost) OVER(PARTITION BY p_partkey)))
------------PhysicalWindow
--------------PhysicalQuickSort
----------------PhysicalDistribute
------------------PhysicalProject
--------------------hashJoin[INNER_JOIN](supplier.s_suppkey = partsupp.ps_suppkey)
----------------------PhysicalProject
------------------------hashJoin[INNER_JOIN](supplier.s_nationkey = nation.n_nationkey)
--------------------------PhysicalOlapScan[supplier]
--------------------------PhysicalDistribute
----------------------------hashJoin[INNER_JOIN](nation.n_regionkey = region.r_regionkey)
------------------------------PhysicalDistribute
--------------------------------PhysicalProject
----------------------------------PhysicalOlapScan[nation]
------------------------------PhysicalDistribute
--------------------------------PhysicalProject
----------------------------------filter((region.r_name = 'EUROPE'))
------------------------------------PhysicalOlapScan[region]
----------------------PhysicalDistribute
------------------------PhysicalProject
--------------------------hashJoin[INNER_JOIN](part.p_partkey = partsupp.ps_partkey)
----------------------------PhysicalProject
------------------------------PhysicalOlapScan[partsupp]
----------------------------PhysicalProject
------------------------------filter((part.p_size = 15)(p_type like '%BRASS'))
--------------------------------PhysicalOlapScan[part]

34 changes: 34 additions & 0 deletions regression-test/data/nereids_hint_tpch_p0/shape/q20.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select --
PhysicalResultSink
--PhysicalQuickSort
----PhysicalDistribute
------PhysicalQuickSort
--------PhysicalProject
----------hashJoin[RIGHT_SEMI_JOIN](supplier.s_suppkey = partsupp.ps_suppkey)
------------PhysicalDistribute
--------------PhysicalProject
----------------hashJoin[INNER_JOIN](lineitem.l_partkey = partsupp.ps_partkey)(lineitem.l_suppkey = partsupp.ps_suppkey)(cast(ps_availqty as DECIMALV3(38, 3)) > (0.5 * sum(l_quantity)))
------------------PhysicalProject
--------------------hashAgg[GLOBAL]
----------------------PhysicalDistribute
------------------------hashAgg[LOCAL]
--------------------------PhysicalProject
----------------------------filter((lineitem.l_shipdate < 1995-01-01)(lineitem.l_shipdate >= 1994-01-01))
------------------------------PhysicalOlapScan[lineitem]
------------------PhysicalDistribute
--------------------hashJoin[LEFT_SEMI_JOIN](partsupp.ps_partkey = part.p_partkey)
----------------------PhysicalProject
------------------------PhysicalOlapScan[partsupp]
----------------------PhysicalProject
------------------------filter((p_name like 'forest%'))
--------------------------PhysicalOlapScan[part]
------------PhysicalDistribute
--------------hashJoin[INNER_JOIN](supplier.s_nationkey = nation.n_nationkey)
----------------PhysicalProject
------------------PhysicalOlapScan[supplier]
----------------PhysicalDistribute
------------------PhysicalProject
--------------------filter((nation.n_name = 'CANADA'))
----------------------PhysicalOlapScan[nation]

Loading

0 comments on commit 982ca43

Please sign in to comment.