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 2014/08/25 22:04:57 UTC

[jira] [Created] (OPTIQ-387) CompileException when cast TRUE to nullable boolean

Julian Hyde created OPTIQ-387:
---------------------------------

             Summary: CompileException when cast TRUE to nullable boolean
                 Key: OPTIQ-387
                 URL: https://issues.apache.org/jira/browse/OPTIQ-387
             Project: Optiq
          Issue Type: Bug
            Reporter: Julian Hyde
            Assignee: Julian Hyde


In contexts where boolean values can be null, we need to convert them to java.lang.Boolean. Query

{code:sql}
select case when deptno = 10 then null else true end
from (values (10), (20)) as t(deptno)
{code}

gives

{code}
Caused by: org.codehaus.commons.compiler.CompileException: Line 25, Column 104: Incompatible expression types "java.lang.Boolean" and "boolean"
	at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:10064)
	at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:3643)
	at org.codehaus.janino.UnitCompiler.access$6600(UnitCompiler.java:181)
	at org.codehaus.janino.UnitCompiler$10.visitConditionalExpression(UnitCompiler.java:3268)
{code}

from compiling the generated code

{code:java}
            public Object current() {
              return net.hydromatic.optiq.runtime.SqlFunctions.toInt(inputEnumerator.current()) == 10 ? (Boolean) null : true;
            }
{code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)