You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2019/01/07 19:04:00 UTC

[jira] [Updated] (CALCITE-2773) Prune of empty values causes assertion error "rel cost is lower than best cost"

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

Julian Hyde updated CALCITE-2773:
---------------------------------
    Description: 
Prune of empty values causes assertion error "rel cost is lower than best cost".
{code:sql}
values(1)
 union all values(2)
 union all select * from (values(3)) where false{code}
it is parsed as
{noformat}
LogicalUnion(all=[true])
  LogicalUnion(all=[true])
    LogicalValues(tuples=[[{ 1 }]])
    LogicalProject(EXPR$0=[$0])
      LogicalFilter(condition=[false])
        LogicalValues(tuples=[[{ 3 }]])
  LogicalValues(tuples=[[{ 2 }]]){noformat}
Then it fails as follows:
{noformat}
java.lang.AssertionError: rel [rel#69:EnumerableUnion.ENUMERABLE.[](input#0=RelSubset#78,input#1=RelSubset#71,all=true)] has lower cost {4.0 rows, 4.0 cpu, 0.0 io} than best cost {5.0 rows, 5.0 cpu, 0.0 io} of subset [rel#67:Subset#6.ENUMERABLE.[]]

	at org.apache.calcite.util.Litmus$1.fail(Litmus.java:31)
	at org.apache.calcite.plan.volcano.VolcanoPlanner.isValid(VolcanoPlanner.java:896)
	at org.apache.calcite.plan.volcano.VolcanoPlanner.register(VolcanoPlanner.java:859)
	at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:876)
	at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:1747)
	at org.apache.calcite.plan.volcano.VolcanoRuleCall.transformTo(VolcanoRuleCall.java:136)
	at org.apache.calcite.plan.RelOptRuleCall.transformTo(RelOptRuleCall.java:236)
	at org.apache.calcite.rel.convert.ConverterRule.onMatch(ConverterRule.java:141)
	at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:213)
	at org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:641)
	at org.apache.calcite.tools.Programs$RuleSetProgram.run(Programs.java:339)
	at org.apache.calcite.prepare.PlannerImpl.transform(PlannerImpl.java:349)
	at org.apache.calcite.tools.PlannerTest.checkUnionPruning(PlannerTest.java:465)
	at org.apache.calcite.tools.PlannerTest.emptyUnions32(PlannerTest.java:436){noformat}

  was:
{code:sql}values(1)
 union all values(2)
 union all select * from (values(3)) where false{code}

it is parsed as
{noformat}LogicalUnion(all=[true])
  LogicalUnion(all=[true])
    LogicalValues(tuples=[[{ 1 }]])
    LogicalProject(EXPR$0=[$0])
      LogicalFilter(condition=[false])
        LogicalValues(tuples=[[{ 3 }]])
  LogicalValues(tuples=[[{ 2 }]]){noformat}

Then it fails as follows:
{noformat}
java.lang.AssertionError: rel [rel#69:EnumerableUnion.ENUMERABLE.[](input#0=RelSubset#78,input#1=RelSubset#71,all=true)] has lower cost {4.0 rows, 4.0 cpu, 0.0 io} than best cost {5.0 rows, 5.0 cpu, 0.0 io} of subset [rel#67:Subset#6.ENUMERABLE.[]]

	at org.apache.calcite.util.Litmus$1.fail(Litmus.java:31)
	at org.apache.calcite.plan.volcano.VolcanoPlanner.isValid(VolcanoPlanner.java:896)
	at org.apache.calcite.plan.volcano.VolcanoPlanner.register(VolcanoPlanner.java:859)
	at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:876)
	at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:1747)
	at org.apache.calcite.plan.volcano.VolcanoRuleCall.transformTo(VolcanoRuleCall.java:136)
	at org.apache.calcite.plan.RelOptRuleCall.transformTo(RelOptRuleCall.java:236)
	at org.apache.calcite.rel.convert.ConverterRule.onMatch(ConverterRule.java:141)
	at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:213)
	at org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:641)
	at org.apache.calcite.tools.Programs$RuleSetProgram.run(Programs.java:339)
	at org.apache.calcite.prepare.PlannerImpl.transform(PlannerImpl.java:349)
	at org.apache.calcite.tools.PlannerTest.checkUnionPruning(PlannerTest.java:465)
	at org.apache.calcite.tools.PlannerTest.emptyUnions32(PlannerTest.java:436){noformat}


> Prune of empty values causes assertion error "rel cost is lower than best cost"
> -------------------------------------------------------------------------------
>
>                 Key: CALCITE-2773
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2773
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.18.0
>            Reporter: Vladimir Sitnikov
>            Assignee: Julian Hyde
>            Priority: Major
>
> Prune of empty values causes assertion error "rel cost is lower than best cost".
> {code:sql}
> values(1)
>  union all values(2)
>  union all select * from (values(3)) where false{code}
> it is parsed as
> {noformat}
> LogicalUnion(all=[true])
>   LogicalUnion(all=[true])
>     LogicalValues(tuples=[[{ 1 }]])
>     LogicalProject(EXPR$0=[$0])
>       LogicalFilter(condition=[false])
>         LogicalValues(tuples=[[{ 3 }]])
>   LogicalValues(tuples=[[{ 2 }]]){noformat}
> Then it fails as follows:
> {noformat}
> java.lang.AssertionError: rel [rel#69:EnumerableUnion.ENUMERABLE.[](input#0=RelSubset#78,input#1=RelSubset#71,all=true)] has lower cost {4.0 rows, 4.0 cpu, 0.0 io} than best cost {5.0 rows, 5.0 cpu, 0.0 io} of subset [rel#67:Subset#6.ENUMERABLE.[]]
> 	at org.apache.calcite.util.Litmus$1.fail(Litmus.java:31)
> 	at org.apache.calcite.plan.volcano.VolcanoPlanner.isValid(VolcanoPlanner.java:896)
> 	at org.apache.calcite.plan.volcano.VolcanoPlanner.register(VolcanoPlanner.java:859)
> 	at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:876)
> 	at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:1747)
> 	at org.apache.calcite.plan.volcano.VolcanoRuleCall.transformTo(VolcanoRuleCall.java:136)
> 	at org.apache.calcite.plan.RelOptRuleCall.transformTo(RelOptRuleCall.java:236)
> 	at org.apache.calcite.rel.convert.ConverterRule.onMatch(ConverterRule.java:141)
> 	at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:213)
> 	at org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:641)
> 	at org.apache.calcite.tools.Programs$RuleSetProgram.run(Programs.java:339)
> 	at org.apache.calcite.prepare.PlannerImpl.transform(PlannerImpl.java:349)
> 	at org.apache.calcite.tools.PlannerTest.checkUnionPruning(PlannerTest.java:465)
> 	at org.apache.calcite.tools.PlannerTest.emptyUnions32(PlannerTest.java:436){noformat}



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