[
https://issues.apache.org/jira/browse/DRILL-3173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14577341#comment-14577341
]
Deneche A. Hakim commented on DRILL-3173:
-----------------------------------------
Drill/Calcite seem to ignore invalid input in OVER clause. {{OVER(PARTITION BY
-1 ORDER BY -1)}} is actually handled as {{OVER()}}. This explains the error
message we get (DRILL-3172).
Postgres too seem to ignore invalid input in OVER clause.
> Invalid inputs are NOT handled properly by Window functions
> -----------------------------------------------------------
>
> Key: DRILL-3173
> URL: https://issues.apache.org/jira/browse/DRILL-3173
> Project: Apache Drill
> Issue Type: Bug
> Components: Query Planning & Optimization
> Affects Versions: 1.0.0
> Environment: faec150598840c40827e6493992d81209aa936da
> Reporter: Khurram Faraaz
> Assignee: Deneche A. Hakim
> Labels: window_function
> Fix For: 1.1.0
>
>
> Invalid input must be properly handled by window functions.
> {code}
> 0: jdbc:drill:schema=dfs.tmp> select count(*) over ( partition by -1 order by
> -1 ) from `airports.csv`;
> Error: SYSTEM ERROR:
> org.apache.calcite.plan.RelOptPlanner$CannotPlanException: Node
> [rel#1674:Subset#7.PHYSICAL.SINGLETON([]).[]] could not be implemented;
> planner state:
> Root: rel#1674:Subset#7.PHYSICAL.SINGLETON([]).[]
> Original rel:
> AbstractConverter(subset=[rel#1674:Subset#7.PHYSICAL.SINGLETON([]).[]],
> convention=[PHYSICAL], DrillDistributionTraitDef=[SINGLETON([])], sort=[[]]):
> rowcount = 69890.0, cumulative cost = {inf}, id = 1676
> DrillScreenRel(subset=[rel#1673:Subset#7.LOGICAL.ANY([]).[]]): rowcount =
> 69890.0, cumulative cost = {6989.0 rows, 6989.0 cpu, 0.0 io, 0.0 network, 0.0
> memory}, id = 1672
> DrillProjectRel(subset=[rel#1671:Subset#6.LOGICAL.ANY([]).[]],
> EXPR$0=[$0]): rowcount = 69890.0, cumulative cost = {0.0 rows, 0.0 cpu, 0.0
> io, 0.0 network, 0.0 memory}, id = 1670
> DrillWindowRel(subset=[rel#1669:Subset#5.LOGICAL.ANY([]).[]],
> window#0=[window(partition {} order by [] range between UNBOUNDED PRECEDING
> and CURRENT ROW aggs [COUNT()])]): rowcount = 69890.0, cumulative cost =
> {69890.0 rows, 139780.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 1668
> DrillScanRel(subset=[rel#1667:Subset#4.LOGICAL.ANY([]).[]],
> table=[[dfs, tmp, airports.csv]], groupscan=[EasyGroupScan
> [selectionRoot=/tmp/airports.csv, numFiles=1, columns=[`*`],
> files=[maprfs:///tmp/airports.csv]]]): rowcount = 69890.0, cumulative cost =
> {69890.0 rows, 0.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 1651
> Sets:
> Set#4, type: RecordType()
> rel#1667:Subset#4.LOGICAL.ANY([]).[], best=rel#1651, importance=0.6561
> rel#1651:DrillScanRel.LOGICAL.ANY([]).[](table=[dfs, tmp,
> airports.csv],groupscan=EasyGroupScan [selectionRoot=/tmp/airports.csv,
> numFiles=1, columns=[`*`], files=[maprfs:///tmp/airports.csv]]),
> rowcount=69890.0, cumulative cost={tiny}
>
> rel#1695:AbstractConverter.LOGICAL.ANY([]).[](input=rel#1694:Subset#4.PHYSICAL.HASH_DISTRIBUTED([]).[],convention=LOGICAL,DrillDistributionTraitDef=ANY([]),sort=[]),
> rowcount=69890.0, cumulative cost={inf}
>
> rel#1713:AbstractConverter.LOGICAL.ANY([]).[](input=rel#1712:Subset#4.PHYSICAL.SINGLETON([]).[],convention=LOGICAL,DrillDistributionTraitDef=ANY([]),sort=[]),
> rowcount=69890.0, cumulative cost={inf}
> rel#1694:Subset#4.PHYSICAL.HASH_DISTRIBUTED([]).[], best=null,
> importance=0.5904900000000001
>
> rel#1696:AbstractConverter.PHYSICAL.HASH_DISTRIBUTED([]).[](input=rel#1667:Subset#4.LOGICAL.ANY([]).[],convention=PHYSICAL,DrillDistributionTraitDef=HASH_DISTRIBUTED([]),sort=[]),
> rowcount=69890.0, cumulative cost={inf}
>
> rel#1714:AbstractConverter.PHYSICAL.HASH_DISTRIBUTED([]).[](input=rel#1712:Subset#4.PHYSICAL.SINGLETON([]).[],convention=PHYSICAL,DrillDistributionTraitDef=HASH_DISTRIBUTED([]),sort=[]),
> rowcount=69890.0, cumulative cost={inf}
>
> rel#1717:HashToRandomExchangePrel.PHYSICAL.HASH_DISTRIBUTED([]).[](input=rel#1712:Subset#4.PHYSICAL.SINGLETON([]).[]),
> rowcount=69890.0, cumulative cost={69891.0 rows, Infinity cpu, 0.0 io, 0.0
> network, 0.0 memory}
> rel#1712:Subset#4.PHYSICAL.SINGLETON([]).[], best=rel#1711,
> importance=0.531441
>
> rel#1715:AbstractConverter.PHYSICAL.SINGLETON([]).[](input=rel#1667:Subset#4.LOGICAL.ANY([]).[],convention=PHYSICAL,DrillDistributionTraitDef=SINGLETON([]),sort=[]),
> rowcount=69890.0, cumulative cost={inf}
>
> rel#1716:AbstractConverter.PHYSICAL.SINGLETON([]).[](input=rel#1694:Subset#4.PHYSICAL.HASH_DISTRIBUTED([]).[],convention=PHYSICAL,DrillDistributionTraitDef=SINGLETON([]),sort=[]),
> rowcount=69890.0, cumulative cost={inf}
>
> rel#1711:ScanPrel.PHYSICAL.SINGLETON([]).[](groupscan=EasyGroupScan
> [selectionRoot=/tmp/airports.csv, numFiles=1, columns=[`*`],
> files=[maprfs:///tmp/airports.csv]]), rowcount=69890.0, cumulative cost={tiny}
>
> rel#1719:UnionExchangePrel.PHYSICAL.SINGLETON([]).[](input=rel#1694:Subset#4.PHYSICAL.HASH_DISTRIBUTED([]).[]),
> rowcount=69890.0, cumulative cost={inf}
> ...
> at
> org.apache.calcite.plan.volcano.RelSubset$CheapestPlanReplacer.visit(RelSubset.java:473)
> ~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
> at
> org.apache.calcite.plan.volcano.RelSubset.buildCheapestPlan(RelSubset.java:317)
> ~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
> at
> org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:811)
> ~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
> at
> org.apache.calcite.tools.Programs$RuleSetProgram.run(Programs.java:303)
> ~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
> at
> org.apache.calcite.prepare.PlannerImpl.transform(PlannerImpl.java:316)
> ~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
> at
> org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToPrel(DefaultSqlHandler.java:315)
> ~[drill-java-exec-1.0.0-mapr-r1-rebuffed.jar:1.0.0-mapr-r1]
> at
> org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan(DefaultSqlHandler.java:190)
> ~[drill-java-exec-1.0.0-mapr-r1-rebuffed.jar:1.0.0-mapr-r1]
> at
> org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:177)
> ~[drill-java-exec-1.0.0-mapr-r1-rebuffed.jar:1.0.0-mapr-r1]
> at
> org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:902)
> [drill-java-exec-1.0.0-mapr-r1-rebuffed.jar:1.0.0-mapr-r1]
> at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:240)
> [drill-java-exec-1.0.0-mapr-r1-rebuffed.jar:1.0.0-mapr-r1]
> ... 3 common frames omitted
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)