You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/07/22 13:07:50 UTC

[GitHub] [calcite] jinxing64 opened a new pull request #1327: [CALCITE-3206] Better error message when param type incompatibility (…

jinxing64 opened a new pull request #1327: [CALCITE-3206] Better error message when param type incompatibility (…
URL: https://github.com/apache/calcite/pull/1327
 
 
   In current code, when we query like below
   ```
     @Test public void test() {
       CalciteAssert.model(HR_FKUK_MODEL)
         .query("select * from \"events\" where \"eventid\"='123'")
         .returns(CalciteAssert.outputResult());
     }
   ```
   Where eventid is of INTEGER type, Calcite will throw exception as below
   ```
   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)
   ```
   It's kind of hard to understand for user to refine the sql.
   
   The exception is thrown when compiling generated code.
   This PR propose to do type checking when conversion from `SqlNode` to `RexNode` and give better message when exception.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services