public boolean isAggregate(SqlNode selectNode) { return (aggFinder.findAgg(selectNode) != null); }
/** * 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 }
/** * Creates a validator. * * @param opTab Operator table * @param catalogReader Catalog reader * @param typeFactory Type factory * @param conformance Compatibility mode */ protected SqlValidatorImpl( SqlOperatorTable opTab, SqlValidatorCatalogReader catalogReader, RelDataTypeFactory typeFactory, SqlConformance conformance) { Linq4j.requireNonNull(opTab); Linq4j.requireNonNull(catalogReader); Linq4j.requireNonNull(typeFactory); Linq4j.requireNonNull(conformance); this.opTab = opTab; this.catalogReader = catalogReader; this.typeFactory = typeFactory; this.conformance = conformance; // NOTE jvs 23-Dec-2003: This is used as the type for dynamic // parameters and null literals until a real type is imposed for them. unknownType = typeFactory.createSqlType(SqlTypeName.NULL); booleanType = typeFactory.createSqlType(SqlTypeName.BOOLEAN); rewriteCalls = true; expandColumnReferences = true; aggFinder = new AggFinder(opTab, false); aggOrOverFinder = new AggFinder(opTab, true); }
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)); } } }
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());