public static Set<WindowFunction> getWindowFunctions( List<Expression> projectCols) { LinkedHashSet<WindowFunction> windowFunctions = new LinkedHashSet<WindowFunction>(); for (Expression singleElementSymbol : projectCols) { AggregateSymbolCollectorVisitor.getAggregates(singleElementSymbol, null, null, null, windowFunctions, null); } return windowFunctions; }
public static final Collection<AggregateSymbol> getAggregates(LanguageObject obj, boolean removeDuplicates) { if (obj == null) { return Collections.emptyList(); } Collection<AggregateSymbol> aggregates = null; if (removeDuplicates) { aggregates = new LinkedHashSet<AggregateSymbol>(); } else { aggregates = new ArrayList<AggregateSymbol>(); } AggregateSymbolCollectorVisitor visitor = new AggregateSymbolCollectorVisitor(aggregates, null); AggregateStopNavigator asn = new AggregateStopNavigator(visitor, null, null); obj.acceptVisitor(asn); return aggregates; }
public static Set<WindowFunction> getWindowFunctions( List<Expression> projectCols) { LinkedHashSet<WindowFunction> windowFunctions = new LinkedHashSet<WindowFunction>(); for (Expression singleElementSymbol : projectCols) { AggregateSymbolCollectorVisitor.getAggregates(singleElementSymbol, null, null, null, windowFunctions, null); } return windowFunctions; }
public static final Collection<AggregateSymbol> getAggregates(LanguageObject obj, boolean removeDuplicates) { if (obj == null) { return Collections.emptyList(); } Collection<AggregateSymbol> aggregates = null; if (removeDuplicates) { aggregates = new LinkedHashSet<AggregateSymbol>(); } else { aggregates = new ArrayList<AggregateSymbol>(); } AggregateSymbolCollectorVisitor visitor = new AggregateSymbolCollectorVisitor(aggregates, null); AggregateStopNavigator asn = new AggregateStopNavigator(visitor, null, null); obj.acceptVisitor(asn); return aggregates; }
public static Set<WindowFunction> getWindowFunctions( List<Expression> projectCols) { LinkedHashSet<WindowFunction> windowFunctions = new LinkedHashSet<WindowFunction>(); for (Expression singleElementSymbol : projectCols) { AggregateSymbolCollectorVisitor.getAggregates(singleElementSymbol, null, null, null, windowFunctions, null); } return windowFunctions; }
public static final Collection<AggregateSymbol> getAggregates(LanguageObject obj, boolean removeDuplicates) { if (obj == null) { return Collections.emptyList(); } Collection<AggregateSymbol> aggregates = null; if (removeDuplicates) { aggregates = new LinkedHashSet<AggregateSymbol>(); } else { aggregates = new ArrayList<AggregateSymbol>(); } AggregateSymbolCollectorVisitor visitor = new AggregateSymbolCollectorVisitor(aggregates, null); AggregateStopNavigator asn = new AggregateStopNavigator(visitor, null, null); obj.acceptVisitor(asn); return aggregates; }
private void validateNoAggsInClause(LanguageObject clause) { if (clause == null) { return; } LinkedHashSet<Expression> aggs = new LinkedHashSet<Expression>(); AggregateSymbolCollectorVisitor.getAggregates(clause, aggs, null, null, aggs, null); if (!aggs.isEmpty()) { handleValidationError(QueryPlugin.Util.getString("SQLParser.Aggregate_only_top_level", aggs), aggs); //$NON-NLS-1$ } }
public static final void getAggregates(LanguageObject obj, Collection<? super AggregateSymbol> aggregates, Collection<? super ElementSymbol> otherElements, Collection<? super Expression> groupingColsUsed, Collection<? super WindowFunction> windowFunctions, Collection<? extends Expression> groupingCols) { AggregateSymbolCollectorVisitor visitor = new AggregateSymbolCollectorVisitor(aggregates, otherElements); visitor.windowFunctions = windowFunctions; AggregateStopNavigator asn = new AggregateStopNavigator(visitor, groupingColsUsed, groupingCols); asn.visitNode(obj); }
private void validateNoNestedAggs(LanguageObject aggExp, boolean windowOnly) { // Check for any nested aggregates (which are not allowed) if(aggExp != null) { HashSet<Expression> nestedAggs = new LinkedHashSet<Expression>(); AggregateSymbolCollectorVisitor.getAggregates(aggExp, windowOnly?null:nestedAggs, null, null, nestedAggs, null); if(!nestedAggs.isEmpty()) { handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0039", nestedAggs), nestedAggs); //$NON-NLS-1$ } } }
public static final void getAggregates(LanguageObject obj, Collection<? super AggregateSymbol> aggregates, Collection<? super ElementSymbol> otherElements, Collection<? super Expression> groupingColsUsed, Collection<? super WindowFunction> windowFunctions, Collection<? extends Expression> groupingCols) { AggregateSymbolCollectorVisitor visitor = new AggregateSymbolCollectorVisitor(aggregates, otherElements); visitor.windowFunctions = windowFunctions; AggregateStopNavigator asn = new AggregateStopNavigator(visitor, groupingColsUsed, groupingCols); asn.visitNode(obj); }
private void validateNoNestedAggs(LanguageObject aggExp, boolean windowOnly) { // Check for any nested aggregates (which are not allowed) if(aggExp != null) { HashSet<Expression> nestedAggs = new LinkedHashSet<Expression>(); AggregateSymbolCollectorVisitor.getAggregates(aggExp, windowOnly?null:nestedAggs, null, null, nestedAggs, null); if(!nestedAggs.isEmpty()) { handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0039", nestedAggs), nestedAggs); //$NON-NLS-1$ } } }
public static final void getAggregates(LanguageObject obj, Collection<? super AggregateSymbol> aggregates, Collection<? super ElementSymbol> otherElements, Collection<? super Expression> groupingColsUsed, Collection<? super WindowFunction> windowFunctions, Collection<? extends Expression> groupingCols) { AggregateSymbolCollectorVisitor visitor = new AggregateSymbolCollectorVisitor(aggregates, otherElements); visitor.windowFunctions = windowFunctions; AggregateStopNavigator asn = new AggregateStopNavigator(visitor, groupingColsUsed, groupingCols); asn.visitNode(obj); }
private void validateNoAggsInClause(LanguageObject clause) { if (clause == null) { return; } LinkedHashSet<Expression> aggs = new LinkedHashSet<Expression>(); AggregateSymbolCollectorVisitor.getAggregates(clause, aggs, null, null, aggs, null); if (!aggs.isEmpty()) { handleValidationError(QueryPlugin.Util.getString("SQLParser.Aggregate_only_top_level", aggs), aggs); //$NON-NLS-1$ } }
private void validateNoNestedAggs(LanguageObject aggExp, boolean windowOnly) { // Check for any nested aggregates (which are not allowed) if(aggExp != null) { HashSet<Expression> nestedAggs = new LinkedHashSet<Expression>(); AggregateSymbolCollectorVisitor.getAggregates(aggExp, windowOnly?null:nestedAggs, null, null, nestedAggs, null); if(!nestedAggs.isEmpty()) { handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0039", nestedAggs), nestedAggs); //$NON-NLS-1$ } } }
private void validateNoAggsInClause(LanguageObject clause) { if (clause == null) { return; } LinkedHashSet<Expression> aggs = new LinkedHashSet<Expression>(); AggregateSymbolCollectorVisitor.getAggregates(clause, aggs, null, null, aggs, null); if (!aggs.isEmpty()) { handleValidationError(QueryPlugin.Util.getString("SQLParser.Aggregate_only_top_level", aggs), aggs); //$NON-NLS-1$ } }
private boolean canAddGrouping(LanguageObject lo) { for (AggregateSymbol as : AggregateSymbolCollectorVisitor.getAggregates(lo, false)) { if (as.isCount() || as.getAggregateFunction() == Type.TEXTAGG) { //these can be non-null for no rows. //TODO: could include udaf as well return false; } } return true; }
private boolean canAddGrouping(LanguageObject lo) { for (AggregateSymbol as : AggregateSymbolCollectorVisitor.getAggregates(lo, false)) { if (as.isCount() || as.getAggregateFunction() == Type.TEXTAGG) { //these can be non-null for no rows. //TODO: could include udaf as well return false; } } return true; }
public boolean hasAggregates() { return getGroupBy() != null || getHaving() != null || !AggregateSymbolCollectorVisitor.getAggregates(getSelect(), false).isEmpty(); }
public boolean hasAggregates() { return getGroupBy() != null || getHaving() != null || !AggregateSymbolCollectorVisitor.getAggregates(getSelect(), false).isEmpty(); }
public boolean hasAggregates() { return getGroupBy() != null || getHaving() != null || !AggregateSymbolCollectorVisitor.getAggregates(getSelect(), false).isEmpty(); }