[
https://issues.apache.org/jira/browse/KYLIN-5830?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
pengfei.zhan resolved KYLIN-5830.
---------------------------------
Resolution: Fixed
> When the query connects two or more tables, the query results are
> inconsistent whether the order by field is in the select field or not
> ---------------------------------------------------------------------------------------------------------------------------------------
>
> Key: KYLIN-5830
> URL: https://issues.apache.org/jira/browse/KYLIN-5830
> Project: Kylin
> Issue Type: New Feature
> Components: Query Engine
> Affects Versions: 5.0-beta
> Reporter: Zhimin Wu
> Assignee: Zhimin Wu
> Priority: Major
> Fix For: 5.0.0
>
>
> Q1:
> {code:java}
> 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{code}
> Calcite Plan:
> {code:java}
> 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]]){code}
> Q2:
> {code:java}
> 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{code}
> Calcite Plan
> {code:java}
> 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]])
> {code}
> 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.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)