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 1705 of file HeavyDBSqlOperatorTable.java.
1706 final SqlNode left = callBinding.operand(0);
1707 final SqlNode right = callBinding.operand(1);
1708 if (SqlUtil.isNullLiteral(left,
false) || left instanceof SqlDynamicParam) {
1711 RelDataType validatedNodeType =
1712 callBinding.getValidator().getValidatedNodeType(left);
1713 RelDataType returnType =
1714 callBinding.getValidator().deriveType(callBinding.getScope(), right);
1715 if (!SqlTypeUtil.canCastFrom(returnType, validatedNodeType,
true)) {
1716 if (throwOnFailure) {
1717 throw callBinding.newError(RESOURCE.cannotCastValue(
1718 validatedNodeType.toString(), returnType.toString()));
1722 if (SqlTypeUtil.areCharacterSetsMismatched(validatedNodeType, returnType)) {
1723 if (throwOnFailure) {
1726 throw callBinding.newError(RESOURCE.cannotCastValue(
1727 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 1668 of file HeavyDBSqlOperatorTable.java.
1669 assert opBinding.getOperandCount() == 2;
1670 RelDataType ret = opBinding.getOperandType(1);
1671 RelDataType firstType = opBinding.getOperandType(0);
1672 ret = opBinding.getTypeFactory().createTypeWithNullability(
1673 ret, firstType.isNullable());
1674 if (opBinding instanceof SqlCallBinding) {
1675 SqlCallBinding callBinding = (SqlCallBinding) opBinding;
1676 SqlNode operand0 = callBinding.operand(0);
1680 if (((operand0 instanceof SqlLiteral)
1681 && (((SqlLiteral) operand0).getValue() == null))
1682 || (operand0 instanceof SqlDynamicParam)) {
1683 final SqlValidatorImpl validator =
1684 (SqlValidatorImpl) callBinding.getValidator();
1685 validator.setValidatedNodeType(operand0, ret);
void com.mapd.calcite.parser.HeavyDBSqlOperatorTable.TryCast.unparse |
( |
SqlWriter |
writer, |
|
|
SqlCall |
call, |
|
|
int |
leftPrec, |
|
|
int |
rightPrec |
|
) |
| |
|
inline |
Definition at line 1738 of file HeavyDBSqlOperatorTable.java.
1739 assert call.operandCount() == 2;
1740 final SqlWriter.Frame frame = writer.startFunCall(getName());
1741 call.operand(0).
unparse(writer, 0, 0);
1743 if (call.operand(1) instanceof SqlIntervalQualifier) {
1744 writer.sep(
"INTERVAL");
1746 call.operand(1).
unparse(writer, 0, 0);
1747 writer.endFunCall(frame);
void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec)
The documentation for this class was generated from the following file: