[ https://issues.apache.org/jira/browse/DRILL-1934?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14287938#comment-14287938 ]
Jinfeng Ni commented on DRILL-1934: ----------------------------------- The cause for the failiing cases is in the logic of Calcite's decorrelator. We probably will revisit this once Drill rebases it's own Optiq/Calcite. > Failure to plan queries containing scalar subqueries without correlation > ------------------------------------------------------------------------ > > Key: DRILL-1934 > URL: https://issues.apache.org/jira/browse/DRILL-1934 > Project: Apache Drill > Issue Type: Bug > Components: Query Planning & Optimization > Affects Versions: 0.8.0 > Reporter: Victoria Markman > Assignee: Jinfeng Ni > > {code} > #Fri Jan 02 21:20:47 EST 2015 > git.commit.id.abbrev=b491cdb > {code} > -- Failing queries > {code} > select * from cp.`tpch/nation.parquet` where n_regionkey < ( select > min(r_regionkey) from cp.`tpch/region.parquet`); > select * from cp.`tpch/nation.parquet` where n_regionkey = ( select > avg(r_regionkey) from cp.`tpch/region.parquet`); > {code} > -- Works with correlation > {code} > select * from cp.`tpch/nation.parquet` n where n.n_regionkey = ( select > min(r.r_regionkey) from cp.`tpch/region.parquet` r where n.n_regionkey = > r.r_regionkey); > {code} > All three queries above have the very similar logical planis produced by > Calcite: > {code} > Query failed: Query failed: Unexpected exception during fragment > initialization: Node [rel#14825:Subset#6.LOGICAL.ANY([]).[]] could not be > implemented; planner state: > Root: rel#14825:Subset#6.LOGICAL.ANY([]).[] > Original rel: > AbstractConverter(subset=[rel#14825:Subset#6.LOGICAL.ANY([]).[]], > convention=[LOGICAL], DrillDistributionTraitDef=[ANY([])], sort=[[]]): > rowcount = 1.7976931348623157E308, cumulative cost = {inf}, id = 14826 > ProjectRel(subset=[rel#14824:Subset#6.NONE.ANY([]).[]], *=[$0]): rowcount = > 1.7976931348623157E308, cumulative cost = {1.7976931348623157E308 rows, > 1.7976931348623157E308 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 14823 > FilterRel(subset=[rel#14822:Subset#5.NONE.ANY([]).[]], condition=[=($1, > $2)]): rowcount = 2.6965397022934733E307, cumulative cost = > {2.6965397022934733E307 rows, 1.7976931348623157E308 cpu, 0.0 io, 0.0 > network, 0.0 memory}, id = 14821 > JoinRel(subset=[rel#14820:Subset#4.NONE.ANY([]).[]], condition=[true], > joinType=[left]): rowcount = 1.7976931348623157E308, cumulative cost = > {1.7976931348623157E308 rows, 0.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = > 14819 > > EnumerableTableAccessRel(subset=[rel#14813:Subset#0.ENUMERABLE.ANY([]).[]], > table=[[cp, tpch/nation.parquet]]): rowcount = 100.0, cumulative cost = > {100.0 rows, 101.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 14794 > AggregateRel(subset=[rel#14818:Subset#3.NONE.ANY([]).[]], group=[{}], > EXPR$0=[AVG($0)]): rowcount = 1.7976931348623158E307, cumulative cost = > {1.7976931348623158E307 rows, 0.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = > 14817 > ProjectRel(subset=[rel#14816:Subset#2.NONE.ANY([]).[]], > r_regionkey=[$1]): rowcount = 100.0, cumulative cost = {100.0 rows, 100.0 > cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 14815 > > EnumerableTableAccessRel(subset=[rel#14814:Subset#1.ENUMERABLE.ANY([]).[]], > table=[[cp, tpch/region.parquet]]): rowcount = 100.0, cumulative cost = > {100.0 rows, 101.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 14795 > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)