You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Julian Hyde <jh...@apache.org> on 2017/05/01 19:32:40 UTC

Re: Exception in VolcanoPlanner while using custom Operators and a rule that transposes two Filters.

I think what’s happening is this. The root is logical, so you’re asking it to produce a logical plan. Logical plans have infinite cost. So they can’t be implemented.

> On Apr 30, 2017, at 2:52 PM, Γιώργος Θεοδωράκης <gi...@gmail.com> wrote:
> 
> Hello,
> 
> I have written a very simple rule for pushing a filter through filter,
> which worked perfectly when I applied it with Volcano on the regular
> implementation of operators. Here is the code of my rule:
> 
>  ...
>  public void onMatch(RelOptRuleCall call) {
>    ...
>    final LogicalFilter newFilter =
> LogicalFilter.create(secFilter.getInput(), filter.getCondition());
>    final LogicalFilter newSecFilter = LogicalFilter.create(newFilter,
> secFilter.getCondition());
>    call.transformTo(newSecFilter);
>  }
> 
> In order to introduce a new cost model, I have created my custom operators.
> However, I see the following error when trying to use this specific rule in
> Volcano:
> 
> My query is:
> select * from (
> select * from s.orders
> where s.orders.units > 10) as s1
> where s1.productid = 15 or s1.productid = 17;
> 
> Exception in thread "main"
> org.apache.calcite.plan.RelOptPlanner$CannotPlanException: Node
> [rel#36:Subset#1.LOGICAL.[0]] could not be implemented; planner state:
> 
> Root: rel#33:Subset#2.LOGICAL.[]
> Original rel:
> 
> Sets:
> Set#0, type: RecordType(TIMESTAMP(0) rowtime, INTEGER orderid, INTEGER
> productid, INTEGER units, INTEGER customerid)
> rel#28:Subset#0.NONE.[0], best=rel#5, importance=0.405
> rel#5:LogicalTableScan.NONE.[[0]](table=[s, orders]), rowcount=500.0,
> cumulative cost={inf}
> rel#35:Subset#0.LOGICAL.[0], best=rel#34, importance=0.81
> rel#34:SaberTableScanRel.LOGICAL.[[0]](table=[s, orders]), rowcount=500.0,
> cumulative cost={500.0 rows, 0.0 cpu, 0.0 io, 500.0 rate, 0.0 memory, 1.0
> window, 0.0 R}
> Set#1, type: RecordType(TIMESTAMP(0) rowtime, INTEGER orderid, INTEGER
> productid, INTEGER units, INTEGER customerid)
> rel#30:Subset#1.NONE.[0], best=rel#47, importance=0.45
> rel#29:LogicalFilter.NONE.[[0]](input=rel#28:Subset#0.NONE.[0],condition=>($3,
> 10)), rowcount=250.0, cumulative cost={inf}
> rel#47:LogicalFilter.NONE.[[0]](input=rel#35:Subset#0.LOGICAL.[0],condition=>($3,
> 10)), rowcount=250.0, cumulative cost={inf}
> rel#36:Subset#1.LOGICAL.[0], best=null, importance=0.9
> rel#39:SaberFilterRel.LOGICAL.[[0]](input=rel#35:Subset#0.LOGICAL.[0],condition=>($3,
> 10)), rowcount=250.0, cumulative cost={501.0 rows, 1.0 cpu, 0.0 io, 0.0
> rate, 0.0 memory, 0.0 window, 0.0 R}
> Set#2, type: RecordType(TIMESTAMP(0) rowtime, INTEGER orderid, INTEGER
> productid, INTEGER units, INTEGER customerid)
> rel#32:Subset#2.NONE.[0], best=rel#31, importance=0.0
> rel#31:LogicalFilter.NONE.[[0]](input=rel#30:Subset#1.NONE.[0],condition=OR(=($2,
> 15), =($2, 17))), rowcount=62.5, cumulative cost={inf}
> rel#43:LogicalFilter.NONE.[[0]](input=rel#42:Subset#3.NONE.[0],condition=>($3,
> 10)), rowcount=62.5, cumulative cost={inf}
> rel#33:Subset#2.LOGICAL.[], best=rel#37, importance=0.0
> rel#37:SaberFilterRel.LOGICAL.[[0]](input=rel#36:Subset#1.LOGICAL.[0],condition=OR(=($2,
> 15), =($2, 17))), rowcount=62.5, cumulative cost={inf}
> rel#45:SaberFilterRel.LOGICAL.[[0]](input=rel#44:Subset#3.LOGICAL.[0],condition=>($3,
> 10)), rowcount=62.5, cumulative cost={502.0 rows, 2.0 cpu, 0.0 io, 0.0
> rate, 0.0 memory, 0.0 window, 0.0 R}
> rel#38:Subset#2.LOGICAL.[0], best=rel#37, importance=0.0
> rel#37:SaberFilterRel.LOGICAL.[[0]](input=rel#36:Subset#1.LOGICAL.[0],condition=OR(=($2,
> 15), =($2, 17))), rowcount=62.5, cumulative cost={inf}
> rel#45:SaberFilterRel.LOGICAL.[[0]](input=rel#44:Subset#3.LOGICAL.[0],condition=>($3,
> 10)), rowcount=62.5, cumulative cost={502.0 rows, 2.0 cpu, 0.0 io, 0.0
> rate, 0.0 memory, 0.0 window, 0.0 R}
> Set#3, type: RecordType(TIMESTAMP(0) rowtime, INTEGER orderid, INTEGER
> productid, INTEGER units, INTEGER customerid)
> rel#42:Subset#3.NONE.[0], best=rel#40, importance=0.45
> rel#40:LogicalFilter.NONE.[[0]](input=rel#35:Subset#0.LOGICAL.[0],condition=OR(=($2,
> 15), =($2, 17))), rowcount=125.0, cumulative cost={inf}
> rel#44:Subset#3.LOGICAL.[0], best=rel#46, importance=0.9
> rel#46:SaberFilterRel.LOGICAL.[[0]](input=rel#35:Subset#0.LOGICAL.[0],condition=OR(=($2,
> 15), =($2, 17))), rowcount=125.0, cumulative cost={501.0 rows, 1.0 cpu, 0.0
> io, 0.0 rate, 0.0 memory, 0.0 window, 0.0 R}
> 
> 
> at
> org.apache.calcite.plan.volcano.RelSubset$CheapestPlanReplacer.visit(RelSubset.java:443)
> at
> org.apache.calcite.plan.volcano.RelSubset$CheapestPlanReplacer.visit(RelSubset.java:465)
> at
> org.apache.calcite.plan.volcano.RelSubset.buildCheapestPlan(RelSubset.java:293)
> at
> org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:666)
> at org.apache.calcite.tools.Programs$RuleSetProgram.run(Programs.java:368)
> at org.apache.calcite.prepare.PlannerImpl.transform(PlannerImpl.java:313)
> at calcite.planner.SaberPlanner.getLogicalPlan(SaberPlanner.java:257)
> at calcite.Tester.main(Tester.java:241)
> 
> 
> Any hints on what am I doing wrong?
> 
> Thank you in advance,
> George


Re: Exception in VolcanoPlanner while using custom Operators and a rule that transposes two Filters.

Posted by Γιώργος Θεοδωράκης <gi...@gmail.com>.
Thank you. My rule was creating logical Filters in the last two lines
instead of my custom ones and failed.

2017-05-01 22:32 GMT+03:00 Julian Hyde <jh...@apache.org>:

> I think what’s happening is this. The root is logical, so you’re asking it
> to produce a logical plan. Logical plans have infinite cost. So they can’t
> be implemented.
>
> > On Apr 30, 2017, at 2:52 PM, Γιώργος Θεοδωράκης <gi...@gmail.com>
> wrote:
> >
> > Hello,
> >
> > I have written a very simple rule for pushing a filter through filter,
> > which worked perfectly when I applied it with Volcano on the regular
> > implementation of operators. Here is the code of my rule:
> >
> >  ...
> >  public void onMatch(RelOptRuleCall call) {
> >    ...
> >    final LogicalFilter newFilter =
> > LogicalFilter.create(secFilter.getInput(), filter.getCondition());
> >    final LogicalFilter newSecFilter = LogicalFilter.create(newFilter,
> > secFilter.getCondition());
> >    call.transformTo(newSecFilter);
> >  }
> >
> > In order to introduce a new cost model, I have created my custom
> operators.
> > However, I see the following error when trying to use this specific rule
> in
> > Volcano:
> >
> > My query is:
> > select * from (
> > select * from s.orders
> > where s.orders.units > 10) as s1
> > where s1.productid = 15 or s1.productid = 17;
> >
> > Exception in thread "main"
> > org.apache.calcite.plan.RelOptPlanner$CannotPlanException: Node
> > [rel#36:Subset#1.LOGICAL.[0]] could not be implemented; planner state:
> >
> > Root: rel#33:Subset#2.LOGICAL.[]
> > Original rel:
> >
> > Sets:
> > Set#0, type: RecordType(TIMESTAMP(0) rowtime, INTEGER orderid, INTEGER
> > productid, INTEGER units, INTEGER customerid)
> > rel#28:Subset#0.NONE.[0], best=rel#5, importance=0.405
> > rel#5:LogicalTableScan.NONE.[[0]](table=[s, orders]), rowcount=500.0,
> > cumulative cost={inf}
> > rel#35:Subset#0.LOGICAL.[0], best=rel#34, importance=0.81
> > rel#34:SaberTableScanRel.LOGICAL.[[0]](table=[s, orders]),
> rowcount=500.0,
> > cumulative cost={500.0 rows, 0.0 cpu, 0.0 io, 500.0 rate, 0.0 memory, 1.0
> > window, 0.0 R}
> > Set#1, type: RecordType(TIMESTAMP(0) rowtime, INTEGER orderid, INTEGER
> > productid, INTEGER units, INTEGER customerid)
> > rel#30:Subset#1.NONE.[0], best=rel#47, importance=0.45
> > rel#29:LogicalFilter.NONE.[[0]](input=rel#28:Subset#0.NONE.[
> 0],condition=>($3,
> > 10)), rowcount=250.0, cumulative cost={inf}
> > rel#47:LogicalFilter.NONE.[[0]](input=rel#35:Subset#0.
> LOGICAL.[0],condition=>($3,
> > 10)), rowcount=250.0, cumulative cost={inf}
> > rel#36:Subset#1.LOGICAL.[0], best=null, importance=0.9
> > rel#39:SaberFilterRel.LOGICAL.[[0]](input=rel#35:Subset#0.
> LOGICAL.[0],condition=>($3,
> > 10)), rowcount=250.0, cumulative cost={501.0 rows, 1.0 cpu, 0.0 io, 0.0
> > rate, 0.0 memory, 0.0 window, 0.0 R}
> > Set#2, type: RecordType(TIMESTAMP(0) rowtime, INTEGER orderid, INTEGER
> > productid, INTEGER units, INTEGER customerid)
> > rel#32:Subset#2.NONE.[0], best=rel#31, importance=0.0
> > rel#31:LogicalFilter.NONE.[[0]](input=rel#30:Subset#1.NONE.[
> 0],condition=OR(=($2,
> > 15), =($2, 17))), rowcount=62.5, cumulative cost={inf}
> > rel#43:LogicalFilter.NONE.[[0]](input=rel#42:Subset#3.NONE.[
> 0],condition=>($3,
> > 10)), rowcount=62.5, cumulative cost={inf}
> > rel#33:Subset#2.LOGICAL.[], best=rel#37, importance=0.0
> > rel#37:SaberFilterRel.LOGICAL.[[0]](input=rel#36:Subset#1.
> LOGICAL.[0],condition=OR(=($2,
> > 15), =($2, 17))), rowcount=62.5, cumulative cost={inf}
> > rel#45:SaberFilterRel.LOGICAL.[[0]](input=rel#44:Subset#3.
> LOGICAL.[0],condition=>($3,
> > 10)), rowcount=62.5, cumulative cost={502.0 rows, 2.0 cpu, 0.0 io, 0.0
> > rate, 0.0 memory, 0.0 window, 0.0 R}
> > rel#38:Subset#2.LOGICAL.[0], best=rel#37, importance=0.0
> > rel#37:SaberFilterRel.LOGICAL.[[0]](input=rel#36:Subset#1.
> LOGICAL.[0],condition=OR(=($2,
> > 15), =($2, 17))), rowcount=62.5, cumulative cost={inf}
> > rel#45:SaberFilterRel.LOGICAL.[[0]](input=rel#44:Subset#3.
> LOGICAL.[0],condition=>($3,
> > 10)), rowcount=62.5, cumulative cost={502.0 rows, 2.0 cpu, 0.0 io, 0.0
> > rate, 0.0 memory, 0.0 window, 0.0 R}
> > Set#3, type: RecordType(TIMESTAMP(0) rowtime, INTEGER orderid, INTEGER
> > productid, INTEGER units, INTEGER customerid)
> > rel#42:Subset#3.NONE.[0], best=rel#40, importance=0.45
> > rel#40:LogicalFilter.NONE.[[0]](input=rel#35:Subset#0.
> LOGICAL.[0],condition=OR(=($2,
> > 15), =($2, 17))), rowcount=125.0, cumulative cost={inf}
> > rel#44:Subset#3.LOGICAL.[0], best=rel#46, importance=0.9
> > rel#46:SaberFilterRel.LOGICAL.[[0]](input=rel#35:Subset#0.
> LOGICAL.[0],condition=OR(=($2,
> > 15), =($2, 17))), rowcount=125.0, cumulative cost={501.0 rows, 1.0 cpu,
> 0.0
> > io, 0.0 rate, 0.0 memory, 0.0 window, 0.0 R}
> >
> >
> > at
> > org.apache.calcite.plan.volcano.RelSubset$CheapestPlanReplacer.visit(
> RelSubset.java:443)
> > at
> > org.apache.calcite.plan.volcano.RelSubset$CheapestPlanReplacer.visit(
> RelSubset.java:465)
> > at
> > org.apache.calcite.plan.volcano.RelSubset.buildCheapestPlan(RelSubset.
> java:293)
> > at
> > org.apache.calcite.plan.volcano.VolcanoPlanner.
> findBestExp(VolcanoPlanner.java:666)
> > at org.apache.calcite.tools.Programs$RuleSetProgram.run(
> Programs.java:368)
> > at org.apache.calcite.prepare.PlannerImpl.transform(
> PlannerImpl.java:313)
> > at calcite.planner.SaberPlanner.getLogicalPlan(SaberPlanner.java:257)
> > at calcite.Tester.main(Tester.java:241)
> >
> >
> > Any hints on what am I doing wrong?
> >
> > Thank you in advance,
> > George
>
>