SqlNode expr2 = validator.expandOrderExpr(select, expr); exprs.add(bb.convertExpression(expr2)); fieldNames.add(deriveAlias(expr, aliases, i));
SqlNode expr2 = validator.expandOrderExpr(select, expr); exprs.add(bb.convertExpression(expr2)); fieldNames.add(deriveAlias(expr, aliases, i));
SqlNode expr2 = validator.expandOrderExpr(select, expr); exprs.add(bb.convertExpression(expr2)); fieldNames.add(deriveAlias(expr, aliases, i));
SqlNode expr2 = validator.expandOrderExpr(select, expr); exprs.add(bb.convertExpression(expr2)); fieldNames.add(deriveAlias(expr, aliases, i));
@Override public void validateCall(SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) { super.validateCall(call, validator, scope, operandScope); final SelectScope selectScope = SqlValidatorUtil.getEnclosingSelectScope(scope); assert selectScope != null; final SqlSelect select = selectScope.getNode(); if (!validator.isAggregate(select)) { throw validator.newValidationError(call, Static.RESOURCE.groupingInAggregate(getName())); } final AggregatingSelectScope aggregatingSelectScope = SqlValidatorUtil.getEnclosingAggregateSelectScope(scope); if (aggregatingSelectScope == null) { // We're probably in the GROUP BY clause throw validator.newValidationError(call, Static.RESOURCE.groupingInWrongClause(getName())); } for (SqlNode operand : call.getOperandList()) { if (scope instanceof OrderByScope) { operand = validator.expandOrderExpr(select, operand); } else { operand = validator.expand(operand, scope); } if (!aggregatingSelectScope.resolved.get().isGroupingExpr(operand)) { throw validator.newValidationError(operand, Static.RESOURCE.groupingArgument(getName())); } } }
@Override public void validateCall(SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) { super.validateCall(call, validator, scope, operandScope); final SelectScope selectScope = SqlValidatorUtil.getEnclosingSelectScope(scope); assert selectScope != null; final SqlSelect select = selectScope.getNode(); if (!validator.isAggregate(select)) { throw validator.newValidationError(call, Static.RESOURCE.groupingInAggregate(getName())); } final AggregatingSelectScope aggregatingSelectScope = SqlValidatorUtil.getEnclosingAggregateSelectScope(scope); if (aggregatingSelectScope == null) { // We're probably in the GROUP BY clause throw validator.newValidationError(call, Static.RESOURCE.groupingInWrongClause(getName())); } for (SqlNode operand : call.getOperandList()) { if (scope instanceof OrderByScope) { operand = validator.expandOrderExpr(select, operand); } else { operand = validator.expand(operand, scope); } if (!aggregatingSelectScope.resolved.get().isGroupingExpr(operand)) { throw validator.newValidationError(operand, Static.RESOURCE.groupingArgument(getName())); } } }
SqlNode converted = validator.expandOrderExpr(select, orderItem);
SqlNode converted = validator.expandOrderExpr(select, orderItem);
SqlNode converted = validator.expandOrderExpr(select, orderItem);
SqlNode converted = validator.expandOrderExpr(select, orderItem);