com.mapd.calcite.parser.HeavyDBSqlOperatorTable.TryCast.TryCast |
( |
| ) |
|
|
inline |
boolean com.mapd.calcite.parser.HeavyDBSqlOperatorTable.TryCast.checkOperandTypes |
( |
SqlCallBinding |
callBinding, |
|
|
boolean |
throwOnFailure |
|
) |
| |
|
inline |
Makes sure that the number and types of arguments are allowable. Operators (such as "ROW" and "AS") which do not check their arguments can override this method.
Definition at line 1593 of file HeavyDBSqlOperatorTable.java.
1594 final SqlNode left = callBinding.operand(0);
1595 final SqlNode right = callBinding.operand(1);
1596 if (SqlUtil.isNullLiteral(left,
false) || left instanceof SqlDynamicParam) {
1599 RelDataType validatedNodeType =
1600 callBinding.getValidator().getValidatedNodeType(left);
1601 RelDataType returnType =
1602 callBinding.getValidator().deriveType(callBinding.getScope(), right);
1603 if (!SqlTypeUtil.canCastFrom(returnType, validatedNodeType,
true)) {
1604 if (throwOnFailure) {
1605 throw callBinding.newError(RESOURCE.cannotCastValue(
1606 validatedNodeType.toString(), returnType.toString()));
1610 if (SqlTypeUtil.areCharacterSetsMismatched(validatedNodeType, returnType)) {
1611 if (throwOnFailure) {
1614 throw callBinding.newError(RESOURCE.cannotCastValue(
1615 validatedNodeType.getFullTypeString(), returnType.getFullTypeString()));
SqlOperandCountRange com.mapd.calcite.parser.HeavyDBSqlOperatorTable.TryCast.getOperandCountRange |
( |
| ) |
|
|
inline |
String com.mapd.calcite.parser.HeavyDBSqlOperatorTable.TryCast.getSignatureTemplate |
( |
final int |
operandsCount | ) |
|
|
inline |
SqlSyntax com.mapd.calcite.parser.HeavyDBSqlOperatorTable.TryCast.getSyntax |
( |
| ) |
|
|
inline |
RelDataType com.mapd.calcite.parser.HeavyDBSqlOperatorTable.TryCast.inferReturnType |
( |
SqlOperatorBinding |
opBinding | ) |
|
|
inline |
Definition at line 1556 of file HeavyDBSqlOperatorTable.java.
1557 assert opBinding.getOperandCount() == 2;
1558 RelDataType ret = opBinding.getOperandType(1);
1559 RelDataType firstType = opBinding.getOperandType(0);
1560 ret = opBinding.getTypeFactory().createTypeWithNullability(
1561 ret, firstType.isNullable());
1562 if (opBinding instanceof SqlCallBinding) {
1563 SqlCallBinding callBinding = (SqlCallBinding) opBinding;
1564 SqlNode operand0 = callBinding.operand(0);
1568 if (((operand0 instanceof SqlLiteral)
1569 && (((SqlLiteral) operand0).getValue() == null))
1570 || (operand0 instanceof SqlDynamicParam)) {
1571 final SqlValidatorImpl validator =
1572 (SqlValidatorImpl) callBinding.getValidator();
1573 validator.setValidatedNodeType(operand0, ret);
void com.mapd.calcite.parser.HeavyDBSqlOperatorTable.TryCast.unparse |
( |
SqlWriter |
writer, |
|
|
SqlCall |
call, |
|
|
int |
leftPrec, |
|
|
int |
rightPrec |
|
) |
| |
|
inline |
Definition at line 1626 of file HeavyDBSqlOperatorTable.java.
1627 assert call.operandCount() == 2;
1628 final SqlWriter.Frame frame = writer.startFunCall(getName());
1629 call.operand(0).
unparse(writer, 0, 0);
1631 if (call.operand(1) instanceof SqlIntervalQualifier) {
1632 writer.sep(
"INTERVAL");
1634 call.operand(1).
unparse(writer, 0, 0);
1635 writer.endFunCall(frame);
void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec)
The documentation for this class was generated from the following file: