Class CastedLiteralOperandTypeChecker

java.lang.Object
org.apache.calcite.sql.type.CastedLiteralOperandTypeChecker
All Implemented Interfaces:
org.apache.calcite.sql.type.SqlOperandTypeChecker, org.apache.calcite.sql.type.SqlSingleOperandTypeChecker

public class CastedLiteralOperandTypeChecker extends Object implements org.apache.calcite.sql.type.SqlSingleOperandTypeChecker
Like LiteralOperandTypeChecker, but also allows casted literals. "Casted literals" are like `CAST(100 AS INTEGER)`. While it doesn't make sense to cast a literal that the user themselves enter, it is important to add a broader validation to allow these literals because Calcite's JDBC driver doesn't allow the wildcards (?)to work without a cast, and there's no workaround it.

This makes sure that the functions using the literal operand type checker can be workaround the JDBC's restriction, without being marked as invalid SQL input

  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.calcite.sql.type.SqlOperandTypeChecker

    org.apache.calcite.sql.type.SqlOperandTypeChecker.Consistency
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static org.apache.calcite.sql.type.SqlSingleOperandTypeChecker
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    checkSingleOperandType(org.apache.calcite.sql.SqlCallBinding callBinding, org.apache.calcite.sql.SqlNode node, int iFormalOperand, boolean throwOnFailure)
     
    getAllowedSignatures(org.apache.calcite.sql.SqlOperator op, String opName)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.calcite.sql.type.SqlOperandTypeChecker

    and, getConsistency, isFixedParameters, isOptional, or, typeInference, withGenerator

    Methods inherited from interface org.apache.calcite.sql.type.SqlSingleOperandTypeChecker

    and, checkOperandTypes, getOperandCountRange, or
  • Field Details

    • LITERAL

      public static org.apache.calcite.sql.type.SqlSingleOperandTypeChecker LITERAL
  • Method Details

    • checkSingleOperandType

      public boolean checkSingleOperandType(org.apache.calcite.sql.SqlCallBinding callBinding, org.apache.calcite.sql.SqlNode node, int iFormalOperand, boolean throwOnFailure)
      Specified by:
      checkSingleOperandType in interface org.apache.calcite.sql.type.SqlSingleOperandTypeChecker
    • getAllowedSignatures

      public String getAllowedSignatures(org.apache.calcite.sql.SqlOperator op, String opName)
      Specified by:
      getAllowedSignatures in interface org.apache.calcite.sql.type.SqlOperandTypeChecker