public boolean isAggregate(SqlNode selectNode) { return (aggFinder.findAgg(selectNode) != null); }
public boolean isAggregate(SqlNode selectNode) { return aggFinder.findAgg(selectNode) != null; }
private SqlNode getAgg(SqlSelect select) { final SelectScope selectScope = getRawSelectScope(select); if (selectScope != null) { final List<SqlNode> selectList = selectScope.getExpandedSelectList(); if (selectList != null) { return aggFinder.findAgg(selectList); } } return aggFinder.findAgg(select.getSelectList()); }
public void validateAggregateParams( SqlCall aggFunction, SqlValidatorScope scope) { // For agg(expr), expr cannot itself contain aggregate function // invocations. For example, SUM(2*MAX(x)) is illegal; when // we see it, we'll report the error for the SUM (not the MAX). // For more than one level of nesting, the error which results // depends on the traversal order for validation. for (SqlNode param : aggFunction.getOperandList()) { final SqlNode agg = aggOrOverFinder.findAgg(param); if (aggOrOverFinder.findAgg(param) != null) { throw newValidationError(aggFunction, RESOURCE.nestedAggIllegal()); } } }
public void validateAggregateParams( SqlCall aggFunction, SqlValidatorScope scope) { // For agg(expr), expr cannot itself contain aggregate function // invocations. For example, SUM(2*MAX(x)) is illegal; when // we see it, we'll report the error for the SUM (not the MAX). // For more than one level of nesting, the error which results // depends on the traversal order for validation. for (SqlNode param : aggFunction.getOperands()) { final SqlNode agg = aggOrOverFinder.findAgg(param); if (aggOrOverFinder.findAgg(param) != null) { throw newValidationError( aggFunction, EigenbaseResource.instance().NestedAggIllegal.ex()); } } }
public boolean isAggregate(SqlSelect select) { return (select.getGroup() != null) || (select.getHaving() != null) || (aggFinder.findAgg(select.getSelectList()) != null); }
/** * Throws an error if there is an aggregate or windowed aggregate in the * given clause. * * @param condition Parse tree * @param clause Name of clause: "WHERE", "GROUP BY", "ON" */ private void validateNoAggs(SqlNode condition, String clause) { final SqlNode agg = aggOrOverFinder.findAgg(condition); if (agg != null) { if (SqlUtil.isCallTo(agg, SqlStdOperatorTable.OVER)) { throw newValidationError(agg, RESOURCE.windowedAggregateIllegalInClause(clause)); } else { throw newValidationError(agg, RESOURCE.aggregateIllegalInClause(clause)); } } }
/** * Throws an error if there is an aggregate or windowed aggregate in the * given clause. * * @param condition Parse tree * @param clause Name of clause: "WHERE", "GROUP BY", "ON" */ private void validateNoAggs(SqlNode condition, String clause) { final SqlNode agg = aggOrOverFinder.findAgg(condition); if (agg != null) { if (SqlUtil.isCallTo(agg, SqlStdOperatorTable.overOperator)) { throw newValidationError( agg, EigenbaseResource.instance() .WindowedAggregateIllegalInClause.ex(clause)); } else { throw newValidationError( agg, EigenbaseResource.instance().AggregateIllegalInClause.ex( clause)); } } }
/** * Validation status. */ public enum Status { /** * Validation has not started for this scope. */ Unvalidated, /** * Validation is in progress for this scope. */ InProgress, /** * Validation has completed (perhaps unsuccessfully). */ Valid }
SqlNode agg = aggFinder.findAgg(groupList); if (agg != null) { throw newValidationError(agg, RESOURCE.aggregateIllegalInGroupBy());
SqlNode agg = aggFinder.findAgg(groupList); if (agg != null) { throw newValidationError(
SqlNode agg = aggFinder.findAgg(orderList); if (agg != null) { throw newValidationError(agg, RESOURCE.aggregateIllegalInOrderBy());