[
https://issues.apache.org/jira/browse/DRILL-388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13917203#comment-13917203
]
Jason Altekruse commented on DRILL-388:
---------------------------------------
I know the current issue is at the parsing level, but do we also need to add an
optimizer rule to add column references outside of the select statement to scan
operations for these types of queries? I could work on a means of identifying
columns in a query if this isn't something we get for free in optiq.
> Doing an ORDER-BY on a column not in the SELECT list gives CannotPlanException
> ------------------------------------------------------------------------------
>
> Key: DRILL-388
> URL: https://issues.apache.org/jira/browse/DRILL-388
> Project: Apache Drill
> Issue Type: Bug
> Reporter: Aman Sinha
> Assignee: Mehant Baid
>
> Queries of the following type where order-by column is not in SELECT list
> give a CannotPlanException. A partial stack trace is shown below.
> 0: jdbc:drill:schema=parquet-local> select _MAP['N_NATIONKEY'] as n_nationkey
> from "/Users/asinha/parquet/nation.parquet" order by _MAP['N_REGIONKEY'];
> org.eigenbase.relopt.RelOptPlanner$CannotPlanException: Node
> [rel#10788:Subset#3.ENUMERABLE.PRESERVE] could not be implemented; planner
> state:
> Root: rel#10788:Subset#3.ENUMERABLE.PRESERVE
> Original rel:
> AbstractConverter(subset=[rel#10788:Subset#3.ENUMERABLE.PRESERVE],
> convention=[ENUMERABLE], sort=[PRESERVE])
> ProjectRel(subset=[rel#10784:Subset#3.NONE.PRESERVE], N_NATIONKEY=[$0])
> SortRel(subset=[rel#10782:Subset#2.NONE.[1 Ascending]], sort0=[$1],
> dir0=[Ascending])
> ProjectRel(subset=[rel#10780:Subset#1.NONE.[]], N_NATIONKEY=[ITEM($0,
> 'N_NATIONKEY')], EXPR$1=[ITEM($0, 'N_REGIONKEY')])
> DrillScan(subset=[rel#10778:Subset#0.DRILL.[]],
> table=[[parquet-local, /Users/asinha/parquet/nation.parquet]])
> Sets:
> Set#0, type: RecordType((VARCHAR, ANY) MAP _MAP)
> rel#10778:Subset#0.DRILL.[], best=rel#10774, importance=0.6561
> rel#10774:DrillScan.DRILL.[](table=[parquet-local,
> /Users/asinha/parquet/nation.parquet]), rowcount=100.0, cumulative
> cost={100.0 rows, 101.0 cpu, 0.0 io}
>
> rel#12031:AbstractConverter.DRILL.[](child=rel#12030:Subset#0.ENUMERABLE.[],convention=DRILL,sort=[]),
> rowcount=100.0, cumulative cost={inf}
> rel#12030:Subset#0.ENUMERABLE.[], best=rel#12029,
> importance=0.5904900000000001
>
> rel#12032:AbstractConverter.ENUMERABLE.[](child=rel#10778:Subset#0.DRILL.[],convention=ENUMERABLE,sort=[]),
> rowcount=100.0, cumulative cost={inf}
>
> rel#12029:EnumerableDrillRel.ENUMERABLE.[](child=rel#10778:Subset#0.DRILL.[]),
> rowcount=100.0, cumulative cost={110.0 rows, 111.0 cpu, 0.0 io}
> Set#1, type: RecordType(ANY N_NATIONKEY, ANY EXPR$1)
> rel#10780:Subset#1.NONE.[], best=null, importance=0.7290000000000001
>
> rel#10779:ProjectRel.NONE.[](child=rel#10778:Subset#0.DRILL.[],N_NATIONKEY=ITEM($0,
> 'N_NATIONKEY'),EXPR$1=ITEM($0, 'N_REGIONKEY')), rowcount=100.0, cumulative
> cost={inf}
>
> rel#10791:CalcRel.NONE.[](child=rel#10778:Subset#0.DRILL.[],expr#0={inputs},expr#1='N_NATIONKEY',expr#2=ITEM($t0,
> $t1),expr#3='N_REGIONKEY',expr#4=ITEM($t0, $t3),N_NATIONKEY=$t2,EXPR$1=$t4),
> rowcount=100.0, cumulative cost={inf}
> rel#11466:SortRel.NONE.[](child=rel#10833:Subset#1.DRILL.[1
> Ascending]), rowcount=100.0, cumulative cost={inf}
>
> rel#11597:SortRel.NONE.[](child=rel#10828:Subset#1.DRILL.PRESERVE),
> rowcount=1.7976931348623157E308, cumulative cost={inf}
>
> rel#11701:SortRel.NONE.[](child=rel#11115:Subset#1.ENUMERABLE.PRESERVE),
> rowcount=1.7976931348623157E308, cumulative cost={inf}
>
> rel#11803:SortRel.NONE.[](child=rel#11082:Subset#1.ENUMERABLE.[1 Ascending]),
> rowcount=100.0, cumulative cost={inf}
> rel#10804:Subset#1.DRILL.[], best=rel#10821,
> importance=0.5904900000000001
>
> rel#10805:AbstractConverter.DRILL.[](child=rel#10780:Subset#1.NONE.[],convention=DRILL,sort=[]),
> rowcount=1.7976931348623157E308, cumulative cost={inf}
>
> rel#10821:DrillProjectRel.DRILL.[](child=rel#10778:Subset#0.DRILL.[],N_NATIONKEY=ITEM($0,
> 'N_NATIONKEY'),EXPR$1=ITEM($0, 'N_REGIONKEY')), rowcount=100.0, cumulative
> cost={110.0 rows, 121.0 cpu, 0.0 io}
>
> rel#10825:AbstractConverter.DRILL.[](child=rel#10824:Subset#1.NONE.[1
> Ascending],convention=DRILL,sort=[]), rowcount=1.7976931348623157E308,
> cumulative cost={inf}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)