Package org.apache.calcite.sql.type
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
FieldsModifier and TypeFieldDescriptionstatic org.apache.calcite.sql.type.SqlSingleOperandTypeChecker -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckSingleOperandType(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, waitMethods inherited from interface org.apache.calcite.sql.type.SqlOperandTypeChecker
and, getConsistency, isFixedParameters, isOptional, or, typeInference, withGeneratorMethods 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:
checkSingleOperandTypein interfaceorg.apache.calcite.sql.type.SqlSingleOperandTypeChecker
-
getAllowedSignatures
- Specified by:
getAllowedSignaturesin interfaceorg.apache.calcite.sql.type.SqlOperandTypeChecker
-