[ 
https://issues.apache.org/jira/browse/CALCITE-3206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16890606#comment-16890606
 ] 

Danny Chan commented on CALCITE-3206:
-------------------------------------

Sorry, i don't think we should make any decision and throw assertion error like 
this, the StandardConvertletTable.java did some work for the function call's 
operands type consistency, but it does not guarantee this, and it only touch 
the standard operator table, how about the UDF/UDAF ?

Also calcite allows some comparable types to be compared directly, like a 
.string and numeric, so please do not make the change to these tests, this 
destroy the semantics.

> 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
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> 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)

Reply via email to