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

Support implicit type cast for operators that use single operand family checker

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.20.0
    • 1.22.0
    • core

    Description

      When the FamilyOperandTypeChecker is used to check single operand data type, support implicit type coercion if we can.

      Now some of the sql operator override method #checkOperandTypes, and use the SqlSingleOperandTypeChecker#checkSingleOperandType to check the operand data type, we should support the implicit type coercion for these operators.

      One impl that need to note:

      we seem always pass the "iformalOperand" as "0" with method SqlSingleOperandTypeChecker#checkSingleOperandType when check the single operand, we need to pass in the real operand index in the call to the checker.

       

      Final solution:

      Caution that we could not(shouldn't) implement implicit type coercion for this checker,
      implicit type coercion has side effect(modify the AST), if this single operand checker is
      subsumed in a composite rule(OR or AND), we can not make any side effect if we
      can not make sure that all the single operands type check are passed(with type coercion).
      But there is an exception: only if the call has just one operand, for this case,
      use {@link SqlOperandTypeChecker#checkOperandTypes} instead.

      We decide to fix these operators separately.

      Attachments

        Issue Links

          Activity

            People

              danny0405 Danny Chen
              danny0405 Danny Chen
              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 - 20m
                  20m