You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Zoltan Haindrich (JIRA)" <ji...@apache.org> on 2018/10/08 16:31:00 UTC

[jira] [Assigned] (CALCITE-2611) Code generation fails if one side of an or contains unknown

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

Zoltan Haindrich reassigned CALCITE-2611:
-----------------------------------------

    Assignee: Zoltan Haindrich  (was: Julian Hyde)

> Code generation fails if one side of an or contains unknown
> -----------------------------------------------------------
>
>                 Key: CALCITE-2611
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2611
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Zoltan Haindrich
>            Assignee: Zoltan Haindrich
>            Priority: Major
>
> This is rather strange...it needs also an and below which contains the unknown.
> Running the following query: 
> {code}
> !connect jdbc:calcite:model=target/test-classes/model.json admin admin
> select (EMPID = 3 and unknown) or ( EMPID  = 3) from emps;
> {code}
> results in a compilation exception;
> the main problem is that there is an interesting field:
> {code}
> static final Object $L4J$C$_null = !null;
> {code}
> full exception:
> {code}
> 0: jdbc:calcite:model=target/test-classes/mod> select (cast(EMPID as integer) = 3 and unknown) or not ( cast(EMPID as integer) = 3) from emps;
> Error: Error while executing SQL "select (cast(EMPID as integer) = 3 and unknown) or not ( cast(EMPID as integer) = 3) from emps": Error while compiling generated Java code:
> org.apache.calcite.DataContext root;
> public org.apache.calcite.linq4j.Enumerable bind(final org.apache.calcite.DataContext root0) {
>   root = root0;
>   final org.apache.calcite.rel.RelNode v1stashed = (org.apache.calcite.rel.RelNode) root.get("v1stashed");
>   final org.apache.calcite.interpreter.Interpreter interpreter = new org.apache.calcite.interpreter.Interpreter(
>     root,
>     v1stashed);
>   return new org.apache.calcite.linq4j.AbstractEnumerable(){
>       public org.apache.calcite.linq4j.Enumerator enumerator() {
>         return new org.apache.calcite.linq4j.Enumerator(){
>             public final org.apache.calcite.linq4j.Enumerator inputEnumerator = interpreter.enumerator();
>             public void reset() {
>               inputEnumerator.reset();
>             }
>             public boolean moveNext() {
>               return inputEnumerator.moveNext();
>             }
>             public void close() {
>               inputEnumerator.close();
>             }
>             public Object current() {
>               final Integer inp5_ = (Integer) ((Object[]) inputEnumerator.current())[5];
>               return inp5_ != null && inp5_.intValue() != 3 ? Boolean.TRUE : inp5_ != null || $L4J$C$_null || inp5_ == null ? (Boolean) null : Boolean.FALSE;
>             }
>             static final Object $L4J$C$_null = !null;
>           };
>       }
>     };
> }
> public Class getElementType() {
>   return java.lang.Boolean.class;
> } (state=,code=0)
> {code}



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