Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3206

Better error message when param type incompatibility

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • None
    • core

    Description

      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

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jinxing6042@126.com Jin Xing
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m