[ 
https://issues.apache.org/jira/browse/CALCITE-3172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16878670#comment-16878670
 ] 

Ruben Quesada Lopez edited comment on CALCITE-3172 at 7/4/19 2:02 PM:
----------------------------------------------------------------------

Example of plan that will throw an Exception:
{code}
RelBuilder builder = ...
RexNode myFilter = ... // could be a parameter whose value we do not know 
beforehand
builder
    .scan("DEPT").as("d")
    .filter(myFilter)
    .project(
        builder.field(1, "d", "DEPTNO"),  // <-- exception if myFilter is 
literal(false)
        builder.field(1, "d", "DNAME"))
    .build();
{code}


was (Author: rubenql):
Example of plan that will throw an Exception:
{code}
RelBuilder builder = ...
RexNode myFilter = ... // could be a parameter whose value we do not know 
beforehand
builder
            .scan("DEPT").as("d")
            .filter(myFilter)
            .project(
                builder.field(1, "d", "DEPTNO"),  // <-- exception if myFilter 
is literal(false)
                builder.field(1, "d", "DNAME"))
            .build();
{code}

> RelBuilder#empty does not keep aliases
> --------------------------------------
>
>                 Key: CALCITE-3172
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3172
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Ruben Quesada Lopez
>            Assignee: Ruben Quesada Lopez
>            Priority: Minor
>             Fix For: 1.21.0
>
>
> {{RelBuilder#empty}} method _"Creates a relational expression that reads from 
> an input and throws all of the rows away... The default implementation 
> creates a Values with the same specified row type as the input"_. However, 
> even though the "original" rowType is kept, its aliases are lost, which can 
> lead to issues when building a plan (especially because this method is used 
> internally by other ones, e.g. by RelBuilder#filter with an "always false" 
> filter).



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

Reply via email to