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

Julian Hyde resolved CALCITE-1488.
----------------------------------
       Resolution: Fixed
    Fix Version/s: 1.11.0

[~gian], Your analysis of the problem is correct, and your proposed fix would 
have worked. However, since we already have rules for "propagating emptiness" 
(in {{PruneEmptyRules}}), the simplest thing is to have {{ValuesReduceRule}} 
back off and let those rules do their job. (After all, if you have a filter or 
project on top of an empty relation, it's a waste of effort to simplify the 
filter or project, because you know the result is going to be empty.) So that's 
what I have done.

Fixed in http://git-wip-us.apache.org/repos/asf/calcite/commit/f36584ab.

You will need to enable {{PruneEmptyRules.PROJECT_INSTANCE}}, if you haven't 
already. 

> ValuesReduceRule should ignore empty Values
> -------------------------------------------
>
>                 Key: CALCITE-1488
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1488
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.10.0
>            Reporter: Gian Merlino
>            Assignee: Julian Hyde
>             Fix For: 1.11.0
>
>
> ValuesReduceRule doesn't propagate rowType on Project of empty Values. If 
> ValuesReduceRule is trying to reduce a Project on top of an empty Values, 
> then changeCount ends up 0, and it returns the underlying Values. This leads 
> to an assertion failure because the returned Values does not have the 
> expected rowType.
> One way to fix this is changing the "Filter had no effect" logic from 
> "{{changeCount == 0}}" to "{{changeCount == 0 && projectExprs == null}}".



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to