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 1351 of file HeavyDBSqlOperatorTable.java.
1352 final SqlNode left = callBinding.operand(0);
1353 final SqlNode right = callBinding.operand(1);
1354 if (SqlUtil.isNullLiteral(left,
false) || left instanceof SqlDynamicParam) {
1357 RelDataType validatedNodeType =
1358 callBinding.getValidator().getValidatedNodeType(left);
1359 RelDataType returnType =
1360 callBinding.getValidator().deriveType(callBinding.getScope(), right);
1361 if (!SqlTypeUtil.canCastFrom(returnType, validatedNodeType,
true)) {
1362 if (throwOnFailure) {
1363 throw callBinding.newError(RESOURCE.cannotCastValue(
1364 validatedNodeType.toString(), returnType.toString()));
1368 if (SqlTypeUtil.areCharacterSetsMismatched(validatedNodeType, returnType)) {
1369 if (throwOnFailure) {
1372 throw callBinding.newError(RESOURCE.cannotCastValue(
1373 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 1314 of file HeavyDBSqlOperatorTable.java.
1315 assert opBinding.getOperandCount() == 2;
1316 RelDataType ret = opBinding.getOperandType(1);
1317 RelDataType firstType = opBinding.getOperandType(0);
1318 ret = opBinding.getTypeFactory().createTypeWithNullability(
1319 ret, firstType.isNullable());
1320 if (opBinding instanceof SqlCallBinding) {
1321 SqlCallBinding callBinding = (SqlCallBinding) opBinding;
1322 SqlNode operand0 = callBinding.operand(0);
1326 if (((operand0 instanceof SqlLiteral)
1327 && (((SqlLiteral) operand0).getValue() == null))
1328 || (operand0 instanceof SqlDynamicParam)) {
1329 final SqlValidatorImpl validator =
1330 (SqlValidatorImpl) callBinding.getValidator();
1331 validator.setValidatedNodeType(operand0, ret);
void com.mapd.calcite.parser.HeavyDBSqlOperatorTable.TryCast.unparse |
( |
SqlWriter |
writer, |
|
|
SqlCall |
call, |
|
|
int |
leftPrec, |
|
|
int |
rightPrec |
|
) |
| |
|
inline |
Definition at line 1384 of file HeavyDBSqlOperatorTable.java.
1385 assert call.operandCount() == 2;
1386 final SqlWriter.Frame frame = writer.startFunCall(getName());
1387 call.operand(0).
unparse(writer, 0, 0);
1389 if (call.operand(1) instanceof SqlIntervalQualifier) {
1390 writer.sep(
"INTERVAL");
1392 call.operand(1).
unparse(writer, 0, 0);
1393 writer.endFunCall(frame);
void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec)
The documentation for this class was generated from the following file: