Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-2639

Planner bug - RelOptPlanner.CannotPlanException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 0.9.0
    • 0.9.0
    • None

    Description

      Reporting this as a separate JIRA as this issue related to a bug in the planner. Performing aggregate on the output returned by Union All results in CannotPlanException. Note that the two inputs to Union All are casted to integer and hence the inputs from both legs are of the same datatype.

      0: jdbc:drill:> select count(c1) from (select cast(columns[0] as int) c1 from `testWindow.csv`) union all (select cast(columns[0] as int) c2 from `testWindow.csv`);
      Query failed: RelOptPlanner.CannotPlanException: Node [rel#59393:Subset#4.LOGICAL.ANY([]).[]] could not be implemented; planner state:
      
      Root: rel#59393:Subset#4.LOGICAL.ANY([]).[]
      Original rel:
      AbstractConverter(subset=[rel#59393:Subset#4.LOGICAL.ANY([]).[]], convention=[LOGICAL], DrillDistributionTraitDef=[ANY([])], sort=[[]]): rowcount = 1.7976931348623157E308, cumulative cost = {inf}, id = 59394
        UnionRel(subset=[rel#59392:Subset#4.NONE.ANY([]).[]], all=[true]): rowcount = 1.7976931348623157E308, cumulative cost = {1.7976931348623157E308 rows, 1.7976931348623157E308 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 59391
          AggregateRel(subset=[rel#59388:Subset#2.NONE.ANY([]).[]], group=[{}], EXPR$0=[COUNT($0)]): rowcount = 1.7976931348623158E307, cumulative cost = {1.7976931348623158E307 rows, 0.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 59387
            ProjectRel(subset=[rel#59386:Subset#1.NONE.ANY([]).[]], c1=[CAST(ITEM($1, 0)):INTEGER]): rowcount = 100.0, cumulative cost = {100.0 rows, 100.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 59385
              EnumerableTableAccessRel(subset=[rel#59384:Subset#0.ENUMERABLE.ANY([]).[]], table=[[dfs, tmp, testWindow.csv]]): rowcount = 100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 59368
          ProjectRel(subset=[rel#59390:Subset#3.NONE.ANY([]).[]], c2=[CAST(ITEM($1, 0)):INTEGER]): rowcount = 100.0, cumulative cost = {100.0 rows, 100.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 59389
            EnumerableTableAccessRel(subset=[rel#59384:Subset#0.ENUMERABLE.ANY([]).[]], table=[[dfs, tmp, testWindow.csv]]): rowcount = 100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 59368
      
      Sets:
      Set#0, type: (DrillRecordRow[*, columns])
      	rel#59384:Subset#0.ENUMERABLE.ANY([]).[], best=rel#59368, importance=0.6561
      		rel#59368:EnumerableTableAccessRel.ENUMERABLE.ANY([]).[](table=[dfs, tmp, testWindow.csv]), rowcount=100.0, cumulative cost={100.0 rows, 101.0 cpu, 0.0 io, 0.0 network, 0.0 memory}
      		rel#59408:AbstractConverter.ENUMERABLE.ANY([]).[](child=rel#59407:Subset#0.LOGICAL.ANY([]).[],convention=ENUMERABLE,DrillDistributionTraitDef=ANY([]),sort=[]), rowcount=1.0, cumulative cost={inf}
      	rel#59407:Subset#0.LOGICAL.ANY([]).[], best=rel#59415, importance=0.5904900000000001
      		rel#59409:AbstractConverter.LOGICAL.ANY([]).[](child=rel#59384:Subset#0.ENUMERABLE.ANY([]).[],convention=LOGICAL,DrillDistributionTraitDef=ANY([]),sort=[]), rowcount=100.0, cumulative cost={inf}
      		rel#59415:DrillScanRel.LOGICAL.ANY([]).[](table=[dfs, tmp, testWindow.csv],groupscan=EasyGroupScan [selectionRoot=/tmp/testWindow.csv, numFiles=1, columns=[`*`], files=[maprfs:/tmp/testWindow.csv]]), rowcount=1.0, cumulative cost={1.0 rows, 10000.0 cpu, 0.0 io, 0.0 network, 0.0 memory}
      Set#1, type: RecordType(INTEGER c1)
      	rel#59386:Subset#1.NONE.ANY([]).[], best=null, importance=0.7290000000000001
      		rel#59385:ProjectRel.NONE.ANY([]).[](child=rel#59384:Subset#0.ENUMERABLE.ANY([]).[],c1=CAST(ITEM($1, 0)):INTEGER), rowcount=100.0, cumulative cost={inf}
      	rel#59404:Subset#1.LOGICAL.ANY([]).[], best=rel#59413, importance=0.36450000000000005
      		rel#59405:AbstractConverter.LOGICAL.ANY([]).[](child=rel#59386:Subset#1.NONE.ANY([]).[],convention=LOGICAL,DrillDistributionTraitDef=ANY([]),sort=[]), rowcount=1.7976931348623157E308, cumulative cost={inf}
      		rel#59413:DrillProjectRel.LOGICAL.ANY([]).[](child=rel#59402:Subset#5.LOGICAL.ANY([]).[],c1=CAST(ITEM($0, 0)):INTEGER), rowcount=1.0, cumulative cost={2.0 rows, 5.0 cpu, 0.0 io, 0.0 network, 0.0 memory}
      		rel#59414:DrillProjectRel.LOGICAL.ANY([]).[](child=rel#59407:Subset#0.LOGICAL.ANY([]).[],c1=CAST(ITEM($1, 0)):INTEGER), rowcount=1.0, cumulative cost={2.0 rows, 10004.0 cpu, 0.0 io, 0.0 network, 0.0 memory}
      Set#2, type: RecordType(BIGINT EXPR$0)
      	rel#59388:Subset#2.NONE.ANY([]).[], best=null, importance=0.81
      		rel#59387:AggregateRel.NONE.ANY([]).[](child=rel#59386:Subset#1.NONE.ANY([]).[],group={},EXPR$0=COUNT($0)), rowcount=1.7976931348623158E307, cumulative cost={inf}
      	rel#59395:Subset#2.LOGICAL.ANY([]).[], best=rel#59406, importance=0.405
      		rel#59396:AbstractConverter.LOGICAL.ANY([]).[](child=rel#59388:Subset#2.NONE.ANY([]).[],convention=LOGICAL,DrillDistributionTraitDef=ANY([]),sort=[]), rowcount=1.7976931348623157E308, cumulative cost={inf}
      		rel#59406:DrillAggregateRel.LOGICAL.ANY([]).[](child=rel#59404:Subset#1.LOGICAL.ANY([]).[],group={},EXPR$0=COUNT($0)), rowcount=1.0, cumulative cost={3.0 rows, 6.0 cpu, 0.0 io, 0.0 network, 0.0 memory}
      Set#3, type: RecordType(INTEGER c2)
      	rel#59390:Subset#3.NONE.ANY([]).[], best=null, importance=0.81
      		rel#59389:ProjectRel.NONE.ANY([]).[](child=rel#59384:Subset#0.ENUMERABLE.ANY([]).[],c2=CAST(ITEM($1, 0)):INTEGER), rowcount=100.0, cumulative cost={inf}
      	rel#59397:Subset#3.LOGICAL.ANY([]).[], best=rel#59403, importance=0.405
      		rel#59398:AbstractConverter.LOGICAL.ANY([]).[](child=rel#59390:Subset#3.NONE.ANY([]).[],convention=LOGICAL,DrillDistributionTraitDef=ANY([]),sort=[]), rowcount=1.7976931348623157E308, cumulative cost={inf}
      		rel#59403:DrillProjectRel.LOGICAL.ANY([]).[](child=rel#59402:Subset#5.LOGICAL.ANY([]).[],c2=CAST(ITEM($0, 0)):INTEGER), rowcount=1.0, cumulative cost={2.0 rows, 5.0 cpu, 0.0 io, 0.0 network, 0.0 memory}
      		rel#59410:DrillProjectRel.LOGICAL.ANY([]).[](child=rel#59407:Subset#0.LOGICAL.ANY([]).[],c2=CAST(ITEM($1, 0)):INTEGER), rowcount=1.0, cumulative cost={2.0 rows, 10004.0 cpu, 0.0 io, 0.0 network, 0.0 memory}
      Set#4, type: RecordType(BIGINT EXPR$0)
      	rel#59392:Subset#4.NONE.ANY([]).[], best=null, importance=0.9
      		rel#59391:UnionRel.NONE.ANY([]).[](input#0=rel#59388:Subset#2.NONE.ANY([]).[],input#1=rel#59390:Subset#3.NONE.ANY([]).[],all=true), rowcount=1.7976931348623157E308, cumulative cost={inf}
      	rel#59393:Subset#4.LOGICAL.ANY([]).[], best=null, importance=1.0
      		rel#59394:AbstractConverter.LOGICAL.ANY([]).[](child=rel#59392:Subset#4.NONE.ANY([]).[],convention=LOGICAL,DrillDistributionTraitDef=ANY([]),sort=[]), rowcount=1.7976931348623157E308, cumulative cost={inf}
      Set#5, type: RecordType(ANY columns)
      	rel#59402:Subset#5.LOGICAL.ANY([]).[], best=rel#59400, importance=0.12728571428571428
      		rel#59400:DrillScanRel.LOGICAL.ANY([]).[](table=[dfs, tmp, testWindow.csv],groupscan=EasyGroupScan [selectionRoot=/tmp/testWindow.csv, numFiles=1, columns=[`columns`[0]], files=[maprfs:/tmp/testWindow.csv]]), rowcount=1.0, cumulative cost={1.0 rows, 1.0 cpu, 0.0 io, 0.0 network, 0.0 memory}
      
      Error: exception while executing query: Failure while executing query. (state=,code=0)
      

      Stack trace from drillbit.log

      Set#5, type: RecordType(ANY columns)
              rel#59402:Subset#5.LOGICAL.ANY([]).[], best=rel#59400, importance=0.12728571428571428
                      rel#59400:DrillScanRel.LOGICAL.ANY([]).[](table=[dfs, tmp, testWindow.csv],groupscan=EasyGroupScan [selectionRoot=/tmp/testWindow.csv, numFiles=1, columns=[`columns`[0]], files=[maprfs:/tmp/testWindow.csv]]), rowcount=1.0, cumulative cost={1.0 rows, 1.0 cpu, 0.0 io, 0.0 network, 0.0 memory}
      
      
              at org.eigenbase.relopt.volcano.RelSubset$CheapestPlanReplacer.visit(RelSubset.java:445) ~[optiq-core-0.9-drill-r20.jar:na]
              at org.eigenbase.relopt.volcano.RelSubset.buildCheapestPlan(RelSubset.java:287) ~[optiq-core-0.9-drill-r20.jar:na]
              at org.eigenbase.relopt.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:677) ~[optiq-core-0.9-drill-r20.jar:na]
              at net.hydromatic.optiq.tools.Programs$RuleSetProgram.run(Programs.java:165) ~[optiq-core-0.9-drill-r20.jar:na]
              at net.hydromatic.optiq.prepare.PlannerImpl.transform(PlannerImpl.java:275) ~[optiq-core-0.9-drill-r20.jar:na]
              at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToDrel(DefaultSqlHandler.java:206) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan(DefaultSqlHandler.java:138) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:145) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:773) [drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:204) [drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              ... 3 common frames omitted
      

      Attachments

        1. DRILL-2639.1.patch
          8 kB
          Sean Hsuan-Yi Chu

        Activity

          People

            seanhychu Sean Hsuan-Yi Chu
            khfaraaz Khurram Faraaz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: