Details
-
New Feature
-
Status: Open
-
Major
-
Resolution: Unresolved
-
5.0-beta
-
None
Description
Q1:
select CUSTOMER.C_PHONE -- ,LO_PARTKEY from SSB.CUSTOMER left join SSB.LINEORDER on CUSTOMER.C_CUSTKEY=LINEORDER.LO_CUSTKEY order by LINEORDER.LO_PARTKEY NULLS LAST LIMIT 500
Calcite Plan:
KapProjectRel(C_PHONE=[$6], ctx=[]) KapLimitRel(ctx=[], fetch=[500]) KapSortRel(sort0=[$12], dir0=[ASC], ctx=[]) KapJoinRel(condition=[=($0, $11)], joinType=[left], ctx=[]) KapTableScan(table=[[SSB, CUSTOMER]], ctx=[1@NDataflow [test]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8]]) KapTableScan(table=[[SSB, LINEORDER]], ctx=[2@NDataflow [test1]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]])
Q2:
select CUSTOMER.C_PHONE ,LO_PARTKEY from SSB.CUSTOMER left join SSB.LINEORDER on CUSTOMER.C_CUSTKEY=LINEORDER.LO_CUSTKEY order by LINEORDER.LO_PARTKEY NULLS LAST LIMIT 500
Calcite Plan
KapLimitRel(ctx=[], fetch=[500]) KapSortRel(sort0=[$1], dir0=[ASC], ctx=[]) KapProjectRel(C_PHONE=[$6], LO_PARTKEY=[$12], ctx=[]) KapJoinRel(condition=[=($0, $11)], joinType=[left], ctx=[]) KapTableScan(table=[[SSB, CUSTOMER]], ctx=[1@NDataflow [test]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8]]) KapTableScan(table=[[SSB, LINEORDER]], ctx=[2@NDataflow [test1]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]])
In SortRel, the columns used are not pushed down to the sub OlapContext. To fix this issue, need to add the columns to the sub OlapContext.