You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2017/11/03 23:21:00 UTC

[jira] [Created] (CALCITE-2032) Error when implicitly converting character literal to date literal

Julian Hyde created CALCITE-2032:
------------------------------------

             Summary: Error when implicitly converting character literal to date literal
                 Key: CALCITE-2032
                 URL: https://issues.apache.org/jira/browse/CALCITE-2032
             Project: Calcite
          Issue Type: Bug
            Reporter: Julian Hyde
            Assignee: Julian Hyde


The following query implicitly converts a character literal to a date literal; it passes validation but fails during code generation.

{code}
select *
from "scott".emp
WHERE hiredate = '1980-12-17';
+-------+-------+-------+------+------------+--------+------+--------+
| EMPNO | ENAME | JOB   | MGR  | HIREDATE   | SAL    | COMM | DEPTNO |
+-------+-------+-------+------+------------+--------+------+--------+
|  7369 | SMITH | CLERK | 7902 | 1980-12-17 | 800.00 |      |     20 |
+-------+-------+-------+------+------------+--------+------+--------+
(1 row)

!ok
{code}

throws

{code}
Error while compiling generated Java code:
	at org.apache.calcite.avatica.Helper.wrap(Helper.java:37)
	at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:108)
	at org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1261)
	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:330)
	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:229)
	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:786)
	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:640)
	at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:610)
	at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:221)
	at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:603)
	at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:638)
	at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:149)
	... 9 more
Caused by: org.codehaus.commons.compiler.CompileException: Line 17, Column 46: Incomparable types 'java.lang.Integer' and 'java.lang.String'
	at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:10092)
	at org.codehaus.janino.UnitCompiler.compileBoolean2(UnitCompiler.java:3080)

{code}

I have added the test case to {{misc.iq}}.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)