/** Throws a validation error if a DISTINCT or ALL quantifier is present but not allowed. */ protected void validateQuantifier(SqlValidator validator, SqlCall call) { if ((null != call.getFunctionQuantifier()) && !isQuantifierAllowed()) { throw validator.newValidationError( call.getFunctionQuantifier(), EigenbaseResource.instance() .FunctionQuantifierNotAllowed .ex(call.getOperator().getName())); } }
public void validateCall( SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) { // The base method validates all operands. We override because // we don't want to validate the identifier. final SqlNode[] operands = call.operands; assert operands.length == 2; assert operands[1] instanceof SqlIdentifier; operands[0].validateExpr(validator, scope); SqlIdentifier id = (SqlIdentifier) operands[1]; if (!id.isSimple()) { throw validator.newValidationError( id, EigenbaseResource.instance().AliasMustBeSimpleIdentifier.ex()); } }