[ 
https://issues.apache.org/jira/browse/CALCITE-2592?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vladimir Sitnikov updated CALCITE-2592:
---------------------------------------
    Description: 
I have added a test case in
https://git-wip-us.apache.org/repos/asf?p=calcite.git;a=commit;h=12cda76c2efca3c1c649dd8cb1538d4928d8f972

The test fails as follows:

{noformat}org.apache.calcite.plan.RelOptPlanner$CannotPlanException: Node 
[rel#7:Subset#2.ENUMERABLE.[]] could not be implemented; planner state:

Root: rel#7:Subset#2.ENUMERABLE.[]
Original rel:
LogicalJoin(subset=[rel#7:Subset#2.ENUMERABLE.[]], condition=[=($0, $2)], 
joinType=[inner]): rowcount = 1.0, cumulative cost = {1.0 rows, 0.0 cpu, 0.0 
io}, id = 5
  LogicalValues(subset=[rel#3:Subset#0.NONE.[1]], tuples=[[{ '2', 'a' }, { '1', 
'b' }]]): rowcount = 2.0, cumulative cost = {2.0 rows, 1.0 cpu, 0.0 io}, id = 0
  LogicalValues(subset=[rel#4:Subset#1.NONE.[]], tuples=[[{ '1', 'x' }, { '2', 
'y' }]]): rowcount = 2.0, cumulative cost = {2.0 rows, 1.0 cpu, 0.0 io}, id = 1

Sets:
Set#0, type: RecordType(CHAR(1) id, CHAR(1) name)
        rel#3:Subset#0.NONE.[1], best=null, importance=0.81
                rel#0:LogicalValues.NONE.[[1]](type=RecordType(CHAR(1) id, 
CHAR(1) name),tuples=[{ '2', 'a' }, { '1', 'b' }]), rowcount=2.0, cumulative 
cost={inf}
        rel#9:Subset#0.ENUMERABLE.[0], best=null, importance=0.9
        rel#30:Subset#0.ENUMERABLE.[1], best=rel#29, importance=0.45
                
rel#29:EnumerableValues.ENUMERABLE.[[1]](type=RecordType(CHAR(1) id, CHAR(1) 
name),tuples=[{ '2', 'a' }, { '1', 'b' }]), rowcount=2.0, cumulative cost={2.0 
rows, 1.0 cpu, 0.0 io}
Set#1, type: RecordType(CHAR(1) id, CHAR(1) name)
        rel#4:Subset#1.NONE.[], best=null, importance=0.81
                rel#1:LogicalValues.NONE.[[0, 1], [1]](type=RecordType(CHAR(1) 
id, CHAR(1) name),tuples=[{ '1', 'x' }, { '2', 'y' }]), rowcount=2.0, 
cumulative cost={inf}
        rel#10:Subset#1.ENUMERABLE.[0], best=rel#27, importance=0.9
                rel#27:EnumerableValues.ENUMERABLE.[[0, 1], 
[1]](type=RecordType(CHAR(1) id, CHAR(1) name),tuples=[{ '1', 'x' }, { '2', 'y' 
}]), rowcount=2.0, cumulative cost={2.0 rows, 1.0 cpu, 0.0 io}
        rel#28:Subset#1.ENUMERABLE.[], best=rel#27, importance=0.45
                rel#27:EnumerableValues.ENUMERABLE.[[0, 1], 
[1]](type=RecordType(CHAR(1) id, CHAR(1) name),tuples=[{ '1', 'x' }, { '2', 'y' 
}]), rowcount=2.0, cumulative cost={2.0 rows, 1.0 cpu, 0.0 io}
Set#2, type: RecordType(CHAR(1) id, CHAR(1) name, CHAR(1) id0, CHAR(1) name0)
        rel#6:Subset#2.NONE.[], best=null, importance=0.9
                
rel#5:LogicalJoin.NONE.[](left=rel#3:Subset#0.NONE.[1],right=rel#4:Subset#1.NONE.[],condition==($0,
 $2),joinType=inner), rowcount=1.0, cumulative cost={inf}
                
rel#15:LogicalProject.NONE.[](input=rel#14:Subset#3.NONE.[],id=$2,name=$3,id0=$0,name0=$1),
 rowcount=1.0, cumulative cost={inf}
        rel#7:Subset#2.ENUMERABLE.[], best=null, importance=1.0
                
rel#8:AbstractConverter.ENUMERABLE.[](input=rel#6:Subset#2.NONE.[],convention=ENUMERABLE,sort=[]),
 rowcount=1.0, cumulative cost={inf}
                rel#11:EnumerableMergeJoin.ENUMERABLE.[[0], 
[2]](left=rel#9:Subset#0.ENUMERABLE.[0],right=rel#10:Subset#1.ENUMERABLE.[0],condition==($0,
 $2),joinType=inner), rowcount=1.0, cumulative cost={inf}
Set#3, type: RecordType(CHAR(1) id, CHAR(1) name, CHAR(1) id0, CHAR(1) name0)
        rel#14:Subset#3.NONE.[], best=null, importance=0.81
                
rel#12:LogicalJoin.NONE.[](left=rel#4:Subset#1.NONE.[],right=rel#3:Subset#0.NONE.[1],condition==($2,
 $0),joinType=inner), rowcount=1.0, cumulative cost={inf}
                
rel#18:LogicalProject.NONE.[](input=rel#6:Subset#2.NONE.[],id=$2,name=$3,id0=$0,name0=$1),
 rowcount=1.0, cumulative cost={inf}
        rel#26:Subset#3.ENUMERABLE.[], best=null, importance=0.405
                rel#25:EnumerableMergeJoin.ENUMERABLE.[[0], 
[2]](left=rel#10:Subset#1.ENUMERABLE.[0],right=rel#9:Subset#0.ENUMERABLE.[0],condition==($0,
 $2),joinType=inner), rowcount=1.0, cumulative cost={inf}



        at 
org.apache.calcite.plan.volcano.RelSubset$CheapestPlanReplacer.visit(RelSubset.java:437)
        at 
org.apache.calcite.plan.volcano.RelSubset.buildCheapestPlan(RelSubset.java:296){noformat}

> EnumerableMergeJoin is never taken
> ----------------------------------
>
>                 Key: CALCITE-2592
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2592
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.17.0
>            Reporter: Vladimir Sitnikov
>            Assignee: Julian Hyde
>            Priority: Major
>
> I have added a test case in
> https://git-wip-us.apache.org/repos/asf?p=calcite.git;a=commit;h=12cda76c2efca3c1c649dd8cb1538d4928d8f972
> The test fails as follows:
> {noformat}org.apache.calcite.plan.RelOptPlanner$CannotPlanException: Node 
> [rel#7:Subset#2.ENUMERABLE.[]] could not be implemented; planner state:
> Root: rel#7:Subset#2.ENUMERABLE.[]
> Original rel:
> LogicalJoin(subset=[rel#7:Subset#2.ENUMERABLE.[]], condition=[=($0, $2)], 
> joinType=[inner]): rowcount = 1.0, cumulative cost = {1.0 rows, 0.0 cpu, 0.0 
> io}, id = 5
>   LogicalValues(subset=[rel#3:Subset#0.NONE.[1]], tuples=[[{ '2', 'a' }, { 
> '1', 'b' }]]): rowcount = 2.0, cumulative cost = {2.0 rows, 1.0 cpu, 0.0 io}, 
> id = 0
>   LogicalValues(subset=[rel#4:Subset#1.NONE.[]], tuples=[[{ '1', 'x' }, { 
> '2', 'y' }]]): rowcount = 2.0, cumulative cost = {2.0 rows, 1.0 cpu, 0.0 io}, 
> id = 1
> Sets:
> Set#0, type: RecordType(CHAR(1) id, CHAR(1) name)
>       rel#3:Subset#0.NONE.[1], best=null, importance=0.81
>               rel#0:LogicalValues.NONE.[[1]](type=RecordType(CHAR(1) id, 
> CHAR(1) name),tuples=[{ '2', 'a' }, { '1', 'b' }]), rowcount=2.0, cumulative 
> cost={inf}
>       rel#9:Subset#0.ENUMERABLE.[0], best=null, importance=0.9
>       rel#30:Subset#0.ENUMERABLE.[1], best=rel#29, importance=0.45
>               
> rel#29:EnumerableValues.ENUMERABLE.[[1]](type=RecordType(CHAR(1) id, CHAR(1) 
> name),tuples=[{ '2', 'a' }, { '1', 'b' }]), rowcount=2.0, cumulative 
> cost={2.0 rows, 1.0 cpu, 0.0 io}
> Set#1, type: RecordType(CHAR(1) id, CHAR(1) name)
>       rel#4:Subset#1.NONE.[], best=null, importance=0.81
>               rel#1:LogicalValues.NONE.[[0, 1], [1]](type=RecordType(CHAR(1) 
> id, CHAR(1) name),tuples=[{ '1', 'x' }, { '2', 'y' }]), rowcount=2.0, 
> cumulative cost={inf}
>       rel#10:Subset#1.ENUMERABLE.[0], best=rel#27, importance=0.9
>               rel#27:EnumerableValues.ENUMERABLE.[[0, 1], 
> [1]](type=RecordType(CHAR(1) id, CHAR(1) name),tuples=[{ '1', 'x' }, { '2', 
> 'y' }]), rowcount=2.0, cumulative cost={2.0 rows, 1.0 cpu, 0.0 io}
>       rel#28:Subset#1.ENUMERABLE.[], best=rel#27, importance=0.45
>               rel#27:EnumerableValues.ENUMERABLE.[[0, 1], 
> [1]](type=RecordType(CHAR(1) id, CHAR(1) name),tuples=[{ '1', 'x' }, { '2', 
> 'y' }]), rowcount=2.0, cumulative cost={2.0 rows, 1.0 cpu, 0.0 io}
> Set#2, type: RecordType(CHAR(1) id, CHAR(1) name, CHAR(1) id0, CHAR(1) name0)
>       rel#6:Subset#2.NONE.[], best=null, importance=0.9
>               
> rel#5:LogicalJoin.NONE.[](left=rel#3:Subset#0.NONE.[1],right=rel#4:Subset#1.NONE.[],condition==($0,
>  $2),joinType=inner), rowcount=1.0, cumulative cost={inf}
>               
> rel#15:LogicalProject.NONE.[](input=rel#14:Subset#3.NONE.[],id=$2,name=$3,id0=$0,name0=$1),
>  rowcount=1.0, cumulative cost={inf}
>       rel#7:Subset#2.ENUMERABLE.[], best=null, importance=1.0
>               
> rel#8:AbstractConverter.ENUMERABLE.[](input=rel#6:Subset#2.NONE.[],convention=ENUMERABLE,sort=[]),
>  rowcount=1.0, cumulative cost={inf}
>               rel#11:EnumerableMergeJoin.ENUMERABLE.[[0], 
> [2]](left=rel#9:Subset#0.ENUMERABLE.[0],right=rel#10:Subset#1.ENUMERABLE.[0],condition==($0,
>  $2),joinType=inner), rowcount=1.0, cumulative cost={inf}
> Set#3, type: RecordType(CHAR(1) id, CHAR(1) name, CHAR(1) id0, CHAR(1) name0)
>       rel#14:Subset#3.NONE.[], best=null, importance=0.81
>               
> rel#12:LogicalJoin.NONE.[](left=rel#4:Subset#1.NONE.[],right=rel#3:Subset#0.NONE.[1],condition==($2,
>  $0),joinType=inner), rowcount=1.0, cumulative cost={inf}
>               
> rel#18:LogicalProject.NONE.[](input=rel#6:Subset#2.NONE.[],id=$2,name=$3,id0=$0,name0=$1),
>  rowcount=1.0, cumulative cost={inf}
>       rel#26:Subset#3.ENUMERABLE.[], best=null, importance=0.405
>               rel#25:EnumerableMergeJoin.ENUMERABLE.[[0], 
> [2]](left=rel#10:Subset#1.ENUMERABLE.[0],right=rel#9:Subset#0.ENUMERABLE.[0],condition==($0,
>  $2),joinType=inner), rowcount=1.0, cumulative cost={inf}
>       at 
> org.apache.calcite.plan.volcano.RelSubset$CheapestPlanReplacer.visit(RelSubset.java:437)
>       at 
> org.apache.calcite.plan.volcano.RelSubset.buildCheapestPlan(RelSubset.java:296){noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to