/** * Validates an expression. * * @param expr Expression * @param scope Scope in which expression occurs */ private void validateExpr(SqlNode expr, SqlValidatorScope scope) { if (expr instanceof SqlCall) { final SqlOperator op = ((SqlCall) expr).getOperator(); if (op.isAggregator() && op.requiresOver()) { throw newValidationError(expr, RESOURCE.absentOverClause()); } } // Call on the expression to validate itself. expr.validateExpr(this, scope); // Perform any validation specific to the scope. For example, an // aggregating scope requires that expressions are valid aggregations. scope.validateExpr(expr); }
break; default: node.validateExpr(this, groupScope);
public void validateExpr(SqlValidator validator, SqlValidatorScope scope) { // While a SqlNodeList is not always a valid expression, this // implementation makes that assumption. It just validates the members // of the list. // // One example where this is valid is the IN operator. The expression // // empno IN (10, 20) // // results in a call with operands // // { SqlIdentifier({"empno"}), // SqlNodeList(SqlLiteral(10), SqlLiteral(20)) } for (SqlNode node : list) { node.validateExpr(validator, scope); } } }
public void validateExpr(SqlValidator validator, SqlValidatorScope scope) { // While a SqlNodeList is not always a valid expression, this // implementation makes that assumption. It just validates the members // of the list. // // One example where this is valid is the IN operator. The expression // // empno IN (10, 20) // // results in a call with operands // // { SqlIdentifier({"empno"}), // SqlNodeList(SqlLiteral(10), SqlLiteral(20)) } for (SqlNode node : list) { node.validateExpr(validator, scope); } } }
public void validateCall( SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) { final SqlCase sqlCase = (SqlCase) call; final SqlNodeList whenOperands = sqlCase.getWhenOperands(); final SqlNodeList thenOperands = sqlCase.getThenOperands(); final SqlNode elseOperand = sqlCase.getElseOperand(); for (SqlNode operand : whenOperands) { operand.validateExpr(validator, operandScope); } for (SqlNode operand : thenOperands) { operand.validateExpr(validator, operandScope); } if (elseOperand != null) { elseOperand.validateExpr(validator, operandScope); } }
public void validateCall( SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) { final SqlCase sqlCase = (SqlCase) call; final SqlNodeList whenOperands = sqlCase.getWhenOperands(); final SqlNodeList thenOperands = sqlCase.getThenOperands(); final SqlNode elseOperand = sqlCase.getElseOperand(); for (SqlNode operand : whenOperands) { operand.validateExpr(validator, operandScope); } for (SqlNode operand : thenOperands) { operand.validateExpr(validator, operandScope); } if (elseOperand != null) { elseOperand.validateExpr(validator, operandScope); } }
public void validateCall( SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) { assert call.getOperator() == this; // Do not visit call.getOperandList().get(1) here. // call.getOperandList().get(1) will be validated when deriveType() is called. call.getOperandList().get(0).validateExpr(validator, operandScope); }
public void validateCall( SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) { assert call.getOperator() == this; // Do not visit call.getOperandList().get(1) here. // call.getOperandList().get(1) will be validated when deriveType() is called. call.getOperandList().get(0).validateExpr(validator, operandScope); }
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 List<SqlNode> operands = call.getOperandList(); assert operands.size() == 2; assert operands.get(1) instanceof SqlIdentifier; operands.get(0).validateExpr(validator, scope); SqlIdentifier id = (SqlIdentifier) operands.get(1); if (!id.isSimple()) { throw validator.newValidationError(id, RESOURCE.aliasMustBeSimpleIdentifier()); } }
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 List<SqlNode> operands = call.getOperandList(); assert operands.size() == 2; assert operands.get(1) instanceof SqlIdentifier; operands.get(0).validateExpr(validator, scope); SqlIdentifier id = (SqlIdentifier) operands.get(1); if (!id.isSimple()) { throw validator.newValidationError(id, RESOURCE.aliasMustBeSimpleIdentifier()); } }
assert call.getOperator() == this; for (SqlNode operand : call.getOperandList()) { operand.validateExpr(validator, operandScope);
assert call.getOperator() == this; for (SqlNode operand : call.getOperandList()) { operand.validateExpr(validator, operandScope);
/** * Validates an expression. * * @param expr Expression * @param scope Scope in which expression occurs */ private void validateExpr(SqlNode expr, SqlValidatorScope scope) { if (expr instanceof SqlCall) { final SqlOperator op = ((SqlCall) expr).getOperator(); if (op.isAggregator() && op.requiresOver()) { throw newValidationError(expr, RESOURCE.absentOverClause()); } } // Call on the expression to validate itself. expr.validateExpr(this, scope); // Perform any validation specific to the scope. For example, an // aggregating scope requires that expressions are valid aggregations. scope.validateExpr(expr); }
/** * Validates an expression. * * @param expr Expression * @param scope Scope in which expression occurs */ private void validateExpr(SqlNode expr, SqlValidatorScope scope) { if (expr instanceof SqlCall) { final SqlOperator op = ((SqlCall) expr).getOperator(); if (op.isAggregator() && op.requiresOver()) { throw newValidationError(expr, RESOURCE.absentOverClause()); } } // Call on the expression to validate itself. expr.validateExpr(this, scope); // Perform any validation specific to the scope. For example, an // aggregating scope requires that expressions are valid aggregations. scope.validateExpr(expr); }
break; default: node.validateExpr(this, groupScope);
break; default: node.validateExpr(this, groupScope);
partitionItem.validateExpr(validator, operandScope); orderItem.validateExpr(validator, scope); } finally { validator.setColumnReferenceExpansion(
partitionItem.validateExpr(validator, operandScope); orderItem.validateExpr(validator, scope); } finally { validator.setColumnReferenceExpansion(