Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3562 Unify function's operands type check logic in validation and behavior in runtime
  3. CALCITE-3563

When resolving method call in calcite runtime, add type check and match mechanism for input arguments

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core

      Description

      Sub-task targets on following issue.

       

      (1)Validation phase allows a wide range of operand types, but the runtime implementation does not cover all cases.
      For example, SqlFunction(MOD) adopts OperandTypes.EXACT_NUMERIC_EXACT_NUMERIC.

      @Test public void test0() {
       final String sql = "SELECT mod(12.5, cast(1 as bigint))";
       CalciteAssert.that()
       .query(sql)
       .returns("EXPR$0=0.5\n");
       }

      We will get:

      java.lang.RuntimeException: while resolving method 'mod[class java.math.BigDecimal, long]' in class class org.apache.calcite.runtime.SqlFunctions
       at org.apache.calcite.linq4j.tree.Types.lookupMethod(Types.java:323)
       at org.apache.calcite.linq4j.tree.Expressions.call(Expressions.java:445)
       at org.apache.calcite.adapter.enumerable.RexImpTable$MethodNameImplementor.implement(RexImpTable.java:2253)
       at org.apache.calcite.adapter.enumerable.RexImpTable.implementCall(RexImpTable.java:1195)

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                donnyzone Feng Zhu
                Reporter:
                donnyzone Feng Zhu
              • Votes:
                0 Vote for this issue
                Watchers:
                3 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