You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "jin xing (JIRA)" <ji...@apache.org> on 2019/07/22 13:02:00 UTC

[jira] [Updated] (CALCITE-3206) Better error message when param type incompatibility

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

jin xing updated CALCITE-3206:
------------------------------
    Description: 
In current code, when we query like below

{code:java}
  @Test public void test() {
    CalciteAssert.model(HR_FKUK_MODEL)
      .query("select * from \"events\" where \"eventid\"='123'")
      .returns(CalciteAssert.outputResult());
  }
{code}
Where {{eventid}} is of INTEGER type, Calcite will throw exception as below

{code:java}
Caused by: org.codehaus.commons.compiler.CompileException: Line 13, Column 100: Cannot compare types "int" and "java.lang.String"
	at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:12211)
	at org.codehaus.janino.UnitCompiler.compileBoolean2(UnitCompiler.java:4239)
	at org.codehaus.janino.UnitCompiler.access$6600(UnitCompiler.java:215)
	at org.codehaus.janino.UnitCompiler$14.visitBinaryOperation(UnitCompiler.java:3957)
	at org.codehaus.janino.UnitCompiler$14.visitBinaryOperation(UnitCompiler.java:3935)
	at org.codehaus.janino.Java$BinaryOperation.accept(Java.java:4864)
	at org.codehaus.janino.UnitCompiler.compileBoolean(UnitCompiler.java:3935)
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2475)
{code}

It's kind of hard to understand for user to refine the sql



> Better error message when param type incompatibility
> ----------------------------------------------------
>
>                 Key: CALCITE-3206
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3206
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: jin xing
>            Priority: Major
>
> In current code, when we query like below
> {code:java}
>   @Test public void test() {
>     CalciteAssert.model(HR_FKUK_MODEL)
>       .query("select * from \"events\" where \"eventid\"='123'")
>       .returns(CalciteAssert.outputResult());
>   }
> {code}
> Where {{eventid}} is of INTEGER type, Calcite will throw exception as below
> {code:java}
> Caused by: org.codehaus.commons.compiler.CompileException: Line 13, Column 100: Cannot compare types "int" and "java.lang.String"
> 	at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:12211)
> 	at org.codehaus.janino.UnitCompiler.compileBoolean2(UnitCompiler.java:4239)
> 	at org.codehaus.janino.UnitCompiler.access$6600(UnitCompiler.java:215)
> 	at org.codehaus.janino.UnitCompiler$14.visitBinaryOperation(UnitCompiler.java:3957)
> 	at org.codehaus.janino.UnitCompiler$14.visitBinaryOperation(UnitCompiler.java:3935)
> 	at org.codehaus.janino.Java$BinaryOperation.accept(Java.java:4864)
> 	at org.codehaus.janino.UnitCompiler.compileBoolean(UnitCompiler.java:3935)
> 	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2475)
> {code}
> It's kind of hard to understand for user to refine the sql



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)