Java Code Examples for org.apache.calcite.sql.SqlCallBinding#newValidationError()
The following examples show how to use
org.apache.calcite.sql.SqlCallBinding#newValidationError() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SqlMultisetQueryConstructor.java From Bats with Apache License 2.0 | 6 votes |
public boolean checkOperandTypes( SqlCallBinding callBinding, boolean throwOnFailure) { final List<RelDataType> argTypes = SqlTypeUtil.deriveAndCollectTypes( callBinding.getValidator(), callBinding.getScope(), callBinding.operands()); final RelDataType componentType = getComponentType( callBinding.getTypeFactory(), argTypes); if (null == componentType) { if (throwOnFailure) { throw callBinding.newValidationError(RESOURCE.needSameTypeParameter()); } return false; } return true; }
Example 2
Source File: SqlMultisetValueConstructor.java From Bats with Apache License 2.0 | 6 votes |
public boolean checkOperandTypes( SqlCallBinding callBinding, boolean throwOnFailure) { final List<RelDataType> argTypes = SqlTypeUtil.deriveAndCollectTypes( callBinding.getValidator(), callBinding.getScope(), callBinding.operands()); if (argTypes.size() == 0) { throw callBinding.newValidationError(RESOURCE.requireAtLeastOneArg()); } final RelDataType componentType = getComponentType( callBinding.getTypeFactory(), argTypes); if (null == componentType) { if (throwOnFailure) { throw callBinding.newValidationError(RESOURCE.needSameTypeParameter()); } return false; } return true; }
Example 3
Source File: SqlMapValueConstructor.java From Bats with Apache License 2.0 | 6 votes |
public boolean checkOperandTypes( SqlCallBinding callBinding, boolean throwOnFailure) { final List<RelDataType> argTypes = SqlTypeUtil.deriveAndCollectTypes( callBinding.getValidator(), callBinding.getScope(), callBinding.operands()); if (argTypes.size() == 0) { throw callBinding.newValidationError(RESOURCE.mapRequiresTwoOrMoreArgs()); } if (argTypes.size() % 2 > 0) { throw callBinding.newValidationError(RESOURCE.mapRequiresEvenArgCount()); } final Pair<RelDataType, RelDataType> componentType = getComponentTypes( callBinding.getTypeFactory(), argTypes); if (null == componentType.left || null == componentType.right) { if (throwOnFailure) { throw callBinding.newValidationError(RESOURCE.needSameTypeParameter()); } return false; } return true; }
Example 4
Source File: SqlMultisetQueryConstructor.java From calcite with Apache License 2.0 | 6 votes |
public boolean checkOperandTypes( SqlCallBinding callBinding, boolean throwOnFailure) { final List<RelDataType> argTypes = SqlTypeUtil.deriveAndCollectTypes( callBinding.getValidator(), callBinding.getScope(), callBinding.operands()); final RelDataType componentType = getComponentType( callBinding.getTypeFactory(), argTypes); if (null == componentType) { if (throwOnFailure) { throw callBinding.newValidationError(RESOURCE.needSameTypeParameter()); } return false; } return true; }
Example 5
Source File: SqlMultisetValueConstructor.java From calcite with Apache License 2.0 | 6 votes |
public boolean checkOperandTypes( SqlCallBinding callBinding, boolean throwOnFailure) { final List<RelDataType> argTypes = SqlTypeUtil.deriveAndCollectTypes( callBinding.getValidator(), callBinding.getScope(), callBinding.operands()); if (argTypes.size() == 0) { throw callBinding.newValidationError(RESOURCE.requireAtLeastOneArg()); } final RelDataType componentType = getComponentType( callBinding.getTypeFactory(), argTypes); if (null == componentType) { if (throwOnFailure) { throw callBinding.newValidationError(RESOURCE.needSameTypeParameter()); } return false; } return true; }
Example 6
Source File: SqlMapValueConstructor.java From calcite with Apache License 2.0 | 6 votes |
public boolean checkOperandTypes( SqlCallBinding callBinding, boolean throwOnFailure) { final List<RelDataType> argTypes = SqlTypeUtil.deriveAndCollectTypes( callBinding.getValidator(), callBinding.getScope(), callBinding.operands()); if (argTypes.size() == 0) { throw callBinding.newValidationError(RESOURCE.mapRequiresTwoOrMoreArgs()); } if (argTypes.size() % 2 > 0) { throw callBinding.newValidationError(RESOURCE.mapRequiresEvenArgCount()); } final Pair<RelDataType, RelDataType> componentType = getComponentTypes( callBinding.getTypeFactory(), argTypes); if (null == componentType.left || null == componentType.right) { if (throwOnFailure) { throw callBinding.newValidationError(RESOURCE.needSameTypeParameter()); } return false; } return true; }
Example 7
Source File: SqlMultisetMemberOfOperator.java From Bats with Apache License 2.0 | 5 votes |
public boolean checkOperandTypes( SqlCallBinding callBinding, boolean throwOnFailure) { if (!OperandTypes.MULTISET.checkSingleOperandType( callBinding, callBinding.operand(1), 0, throwOnFailure)) { return false; } MultisetSqlType mt = (MultisetSqlType) callBinding.getValidator().deriveType( callBinding.getScope(), callBinding.operand(1)); RelDataType t0 = callBinding.getValidator().deriveType( callBinding.getScope(), callBinding.operand(0)); RelDataType t1 = mt.getComponentType(); if (t0.getFamily() != t1.getFamily()) { if (throwOnFailure) { throw callBinding.newValidationError( RESOURCE.typeNotComparableNear(t0.toString(), t1.toString())); } return false; } return true; }
Example 8
Source File: SqlMultisetMemberOfOperator.java From calcite with Apache License 2.0 | 5 votes |
public boolean checkOperandTypes( SqlCallBinding callBinding, boolean throwOnFailure) { if (!OperandTypes.MULTISET.checkSingleOperandType( callBinding, callBinding.operand(1), 0, throwOnFailure)) { return false; } MultisetSqlType mt = (MultisetSqlType) callBinding.getValidator().deriveType( callBinding.getScope(), callBinding.operand(1)); RelDataType t0 = callBinding.getValidator().deriveType( callBinding.getScope(), callBinding.operand(0)); RelDataType t1 = mt.getComponentType(); if (t0.getFamily() != t1.getFamily()) { if (throwOnFailure) { throw callBinding.newValidationError( RESOURCE.typeNotComparableNear(t0.toString(), t1.toString())); } return false; } return true; }