You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Milinda Pathirage <mp...@umail.iu.edu> on 2015/09/04 20:02:21 UTC

Query Planning Error

Hi Devs,

I am getting following error when I tried PlannerImpl#transform with a
custom set of rules (but all rules are from Calcite). Please let me know if
anyone have any ideas about a possible reason for this error.

    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)


I haven't seen this before. I got this after I changed my code to use
Frameworks#getPlanner.

Thanks in advance
Milinda

-- 
Milinda Pathirage

PhD Student | Research Assistant
School of Informatics and Computing | Data to Insight Center
Indiana University

twitter: milindalakmal
skype: milinda.pathirage
blog: http://milinda.pathirage.org

Re: Query Planning Error

Posted by Julian Hyde <jh...@apache.org>.
I concur with Jinfeng; you need a physical implementation of your
table in a convention other than NONE ("NONE" is the same as
"logical"). Lots of options for this:
* write a rule, similar to EnumerableTableScanRule;
* override RelOptTable.toRel;
* have your table Table implement TranslatableTable or ScannableTable
or FilterableTable or ProjectableFilterableTable;
* set CalcitePrepareImpl.ENABLE_BINDABLE ;
* set CalcitePrepareImpl.ENABLE_ENUMERABLE.

The last 3 of these kick in when RelOptTableImpl.toRel is called.

Julian


On Fri, Sep 4, 2015 at 11:55 AM, Milinda Pathirage
<mp...@umail.iu.edu> wrote:
> Here is the gist (https://gist.github.com/milinda/4eca6855e1c491d33d7c)
> containing the error.
>
> Thanks
> Milinda
>
> On Fri, Sep 4, 2015 at 2:54 PM, Milinda Pathirage <mp...@umail.iu.edu>
> wrote:
>
>> Thank you very much Jinfeng for pointing the reason behind the error. I
>> think gmail truncated the error message. I should have use pastebin or gist.
>>
>> Milinda
>>
>> On Fri, Sep 4, 2015 at 2:27 PM, Jinfeng Ni <ji...@gmail.com> wrote:
>>
>>> This means you miss some rule(s) to  convert from "None" convention to
>>> "Logical" convention.
>>>
>>> In particular, in the trace you posted:
>>>
>>>  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}
>>>
>>> RelSubSet #16 only has one rel node #17, whose input is rel#15:Subset#2.
>>> Seems you do not have rule
>>> to convert LogicalDelta.NONE or LogicalProject.NONE to a RelNode in
>>> LOGICAL
>>> convention. As a result,
>>> the cumulative cost is infinity, and "best" is null. That's why
>>> VolcanoPlanner will report CanNotPlan error.
>>>
>>> btw: the trace you posted seems to be not well formated.
>>>
>>>
>>>
>>>
>>> On Fri, Sep 4, 2015 at 11:02 AM, Milinda Pathirage <mpathira@umail.iu.edu
>>> >
>>> wrote:
>>>
>>> > Hi Devs,
>>> >
>>> > I am getting following error when I tried PlannerImpl#transform with a
>>> > custom set of rules (but all rules are from Calcite). Please let me
>>> know if
>>> > anyone have any ideas about a possible reason for this error.
>>> >
>>> >     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)
>>> >
>>> >
>>> > I haven't seen this before. I got this after I changed my code to use
>>> > Frameworks#getPlanner.
>>> >
>>> > Thanks in advance
>>> > Milinda
>>> >
>>> > --
>>> > Milinda Pathirage
>>> >
>>> > PhD Student | Research Assistant
>>> > School of Informatics and Computing | Data to Insight Center
>>> > Indiana University
>>> >
>>> > twitter: milindalakmal
>>> > skype: milinda.pathirage
>>> > blog: http://milinda.pathirage.org
>>> >
>>>
>>
>>
>>
>> --
>> Milinda Pathirage
>>
>> PhD Student | Research Assistant
>> School of Informatics and Computing | Data to Insight Center
>> Indiana University
>>
>> twitter: milindalakmal
>> skype: milinda.pathirage
>> blog: http://milinda.pathirage.org
>>
>
>
>
> --
> Milinda Pathirage
>
> PhD Student | Research Assistant
> School of Informatics and Computing | Data to Insight Center
> Indiana University
>
> twitter: milindalakmal
> skype: milinda.pathirage
> blog: http://milinda.pathirage.org

Re: Query Planning Error

Posted by Milinda Pathirage <mp...@umail.iu.edu>.
Here is the gist (https://gist.github.com/milinda/4eca6855e1c491d33d7c)
containing the error.

Thanks
Milinda

On Fri, Sep 4, 2015 at 2:54 PM, Milinda Pathirage <mp...@umail.iu.edu>
wrote:

> Thank you very much Jinfeng for pointing the reason behind the error. I
> think gmail truncated the error message. I should have use pastebin or gist.
>
> Milinda
>
> On Fri, Sep 4, 2015 at 2:27 PM, Jinfeng Ni <ji...@gmail.com> wrote:
>
>> This means you miss some rule(s) to  convert from "None" convention to
>> "Logical" convention.
>>
>> In particular, in the trace you posted:
>>
>>  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}
>>
>> RelSubSet #16 only has one rel node #17, whose input is rel#15:Subset#2.
>> Seems you do not have rule
>> to convert LogicalDelta.NONE or LogicalProject.NONE to a RelNode in
>> LOGICAL
>> convention. As a result,
>> the cumulative cost is infinity, and "best" is null. That's why
>> VolcanoPlanner will report CanNotPlan error.
>>
>> btw: the trace you posted seems to be not well formated.
>>
>>
>>
>>
>> On Fri, Sep 4, 2015 at 11:02 AM, Milinda Pathirage <mpathira@umail.iu.edu
>> >
>> wrote:
>>
>> > Hi Devs,
>> >
>> > I am getting following error when I tried PlannerImpl#transform with a
>> > custom set of rules (but all rules are from Calcite). Please let me
>> know if
>> > anyone have any ideas about a possible reason for this error.
>> >
>> >     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)
>> >
>> >
>> > I haven't seen this before. I got this after I changed my code to use
>> > Frameworks#getPlanner.
>> >
>> > Thanks in advance
>> > Milinda
>> >
>> > --
>> > Milinda Pathirage
>> >
>> > PhD Student | Research Assistant
>> > School of Informatics and Computing | Data to Insight Center
>> > Indiana University
>> >
>> > twitter: milindalakmal
>> > skype: milinda.pathirage
>> > blog: http://milinda.pathirage.org
>> >
>>
>
>
>
> --
> Milinda Pathirage
>
> PhD Student | Research Assistant
> School of Informatics and Computing | Data to Insight Center
> Indiana University
>
> twitter: milindalakmal
> skype: milinda.pathirage
> blog: http://milinda.pathirage.org
>



-- 
Milinda Pathirage

PhD Student | Research Assistant
School of Informatics and Computing | Data to Insight Center
Indiana University

twitter: milindalakmal
skype: milinda.pathirage
blog: http://milinda.pathirage.org

Re: Query Planning Error

Posted by Milinda Pathirage <mp...@umail.iu.edu>.
Thank you very much Jinfeng for pointing the reason behind the error. I
think gmail truncated the error message. I should have use pastebin or gist.

Milinda

On Fri, Sep 4, 2015 at 2:27 PM, Jinfeng Ni <ji...@gmail.com> wrote:

> This means you miss some rule(s) to  convert from "None" convention to
> "Logical" convention.
>
> In particular, in the trace you posted:
>
>  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}
>
> RelSubSet #16 only has one rel node #17, whose input is rel#15:Subset#2.
> Seems you do not have rule
> to convert LogicalDelta.NONE or LogicalProject.NONE to a RelNode in LOGICAL
> convention. As a result,
> the cumulative cost is infinity, and "best" is null. That's why
> VolcanoPlanner will report CanNotPlan error.
>
> btw: the trace you posted seems to be not well formated.
>
>
>
>
> On Fri, Sep 4, 2015 at 11:02 AM, Milinda Pathirage <mp...@umail.iu.edu>
> wrote:
>
> > Hi Devs,
> >
> > I am getting following error when I tried PlannerImpl#transform with a
> > custom set of rules (but all rules are from Calcite). Please let me know
> if
> > anyone have any ideas about a possible reason for this error.
> >
> >     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)
> >
> >
> > I haven't seen this before. I got this after I changed my code to use
> > Frameworks#getPlanner.
> >
> > Thanks in advance
> > Milinda
> >
> > --
> > Milinda Pathirage
> >
> > PhD Student | Research Assistant
> > School of Informatics and Computing | Data to Insight Center
> > Indiana University
> >
> > twitter: milindalakmal
> > skype: milinda.pathirage
> > blog: http://milinda.pathirage.org
> >
>



-- 
Milinda Pathirage

PhD Student | Research Assistant
School of Informatics and Computing | Data to Insight Center
Indiana University

twitter: milindalakmal
skype: milinda.pathirage
blog: http://milinda.pathirage.org

Re: Query Planning Error

Posted by Jinfeng Ni <ji...@gmail.com>.
This means you miss some rule(s) to  convert from "None" convention to
"Logical" convention.

In particular, in the trace you posted:

 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}

RelSubSet #16 only has one rel node #17, whose input is rel#15:Subset#2.
Seems you do not have rule
to convert LogicalDelta.NONE or LogicalProject.NONE to a RelNode in LOGICAL
convention. As a result,
the cumulative cost is infinity, and "best" is null. That's why
VolcanoPlanner will report CanNotPlan error.

btw: the trace you posted seems to be not well formated.




On Fri, Sep 4, 2015 at 11:02 AM, Milinda Pathirage <mp...@umail.iu.edu>
wrote:

> Hi Devs,
>
> I am getting following error when I tried PlannerImpl#transform with a
> custom set of rules (but all rules are from Calcite). Please let me know if
> anyone have any ideas about a possible reason for this error.
>
>     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)
>
>
> I haven't seen this before. I got this after I changed my code to use
> Frameworks#getPlanner.
>
> Thanks in advance
> Milinda
>
> --
> Milinda Pathirage
>
> PhD Student | Research Assistant
> School of Informatics and Computing | Data to Insight Center
> Indiana University
>
> twitter: milindalakmal
> skype: milinda.pathirage
> blog: http://milinda.pathirage.org
>