Skip to content

Instantly share code, notes, and snippets.

@milinda
Created September 4, 2015 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milinda/4eca6855e1c491d33d7c to your computer and use it in GitHub Desktop.
Save milinda/4eca6855e1c491d33d7c to your computer and use it in GitHub Desktop.
org.apache.calcite.plan.RelOptPlanner$CannotPlanException: Node [rel#16:Subset#2.LOGICAL.[]] could not be implemented; planner state:
Root: rel#16:Subset#2.LOGICAL.[]
Original rel:
Sets:
Set#0, type: RecordType(INTEGER id, VARCHAR(10) productId, INTEGER units, TIMESTAMP(0) rowtime)
rel#11:Subset#0.NONE.[], best=null, importance=0.7290000000000001
rel#3:LogicalTableScan.NONE.[](table=[KAFKA, ORDERS]), rowcount=100.0, cumulative cost={inf}
Set#1, type: RecordType(VARCHAR(10) productId, INTEGER units)
rel#13:Subset#1.NONE.[], best=null, importance=0.81
rel#12:LogicalProject.NONE.[](input=rel#11:Subset#0.NONE.[],productId=$1,units=$2), rowcount=100.0, cumulative cost={inf}
Set#2, type: RecordType(VARCHAR(10) productId, INTEGER units)
rel#15:Subset#2.NONE.[], best=null, importance=0.9
rel#14:LogicalDelta.NONE.[](input=rel#13:Subset#1.NONE.[]), rowcount=100.0, cumulative cost={inf}
rel#21:LogicalProject.NONE.[](input=rel#20:Subset#3.NONE.[],productId=$1,units=$2), rowcount=100.0, cumulative cost={inf}
rel#16:Subset#2.LOGICAL.[], best=null, importance=1.0
rel#17:AbstractConverter.LOGICAL.[](input=rel#15:Subset#2.NONE.[],convention=LOGICAL,sort=[]), rowcount=100.0, cumulative cost={inf}
Set#3, type: RecordType(INTEGER id, VARCHAR(10) productId, INTEGER units, TIMESTAMP(0) rowtime)
rel#20:Subset#3.NONE.[], best=null, importance=0.81
rel#18:LogicalDelta.NONE.[](input=rel#11:Subset#0.NONE.[]), rowcount=100.0, cumulative cost={inf}
rel#22:LogicalTableScan.NONE.[[3]](table=[]), rowcount=100.0, cumulative cost={inf}
rel#23:Subset#3.NONE.[3], best=null, importance=0.405
rel#22:LogicalTableScan.NONE.[[3]](table=[]), rowcount=100.0, cumulative cost={inf}
at org.apache.calcite.plan.volcano.RelSubset$CheapestPlanReplacer.visit(RelSubset.java:473)
at org.apache.calcite.plan.volcano.RelSubset.buildCheapestPlan(RelSubset.java:317)
at org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:823)
at org.apache.calcite.tools.Programs$RuleSetProgram.run(Programs.java:303)
at org.apache.calcite.prepare.PlannerImpl.transform(PlannerImpl.java:268)
at org.apache.samza.sql.planner.QueryPlanner.convertToSamzaRel(QueryPlanner.java:115)
at org.apache.samza.sql.planner.QueryPlanner.validateAndConvert(QueryPlanner.java:109)
at org.apache.samza.sql.planner.QueryPlanner.getPlan(QueryPlanner.java:98)
at org.apache.samza.sql.planner.TestQueryPlanner.testSimpleProject(TestQueryPlanner.java:108)
@prakharsharma
Copy link

prakharsharma commented Jan 10, 2019

Hey Milinda,

I know I am (3 years) late to the party, but, will still take my chances ...

Were you able to resolve this error? If yes, how? I am trying to do something similar, where I combine 2 plans (RelNode) using a LogicalUnion and then try to optimize the plan using RelOptPlanner.findBestExp and run into a similar error. Quick gist of what I am doing

RelBuilder relBuilder = ...
RelNode a = ...
RelNode b = ...
RelNode union = relBuilder.union(true)
RelOptPlanner planner = union.getCluster().getPlanner()
planner.setRoot(union)
RelNode optimizedPlan = planner.findBestExp()

This gives an error very similar to the one in your gist.

Thanks,
Prakhar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment