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/04 15:50:00 UTC

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=16638411#comment-16638411 ] 

Zoltan Haindrich commented on CALCITE-2611:
-------------------------------------------

I'm not sure how to get started with this issue right now....
but adding the following test to {{ReflectiveSchemaTest}} also reproduces the issue:
{code}
  @Test public void testX() {
    CalciteAssert.that()
        .withSchema("s", CATCHALL)
        .query("select (\"value\" = 3 and unknown) or ( \"value\"  = 3 ) from \"s\".\"primesCustomBoxed\"")
        .returnsUnordered("value=2");
  }
{code}

> 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: Julian Hyde
>            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)