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; }
/** * This validation is more convoluted than needed since it is being run before rewrite/planning. * Ideally we would already have correlated references set on the subqueries. */ private void validateCorrelatedReferences(Query query, final List<GroupSymbol> correlationGroups, final Set<Expression> groupingSymbols, LanguageObject object, LinkedHashSet<Expression> invalid) { if (query.getFrom() == null) { return; } ElementCollectorVisitor ecv = new ElementCollectorVisitor(invalid) { public void visit(ElementSymbol obj) { if (obj.isExternalReference() && correlationGroups.contains(obj.getGroupSymbol()) && (groupingSymbols == null || !groupingSymbols.contains(obj))) { super.visit(obj); } } }; AggregateStopNavigator asn = new AggregateStopNavigator(ecv, groupingSymbols); object.acceptVisitor(asn); }
/** * This validation is more convoluted than needed since it is being run before rewrite/planning. * Ideally we would already have correlated references set on the subqueries. */ private void validateCorrelatedReferences(Query query, final List<GroupSymbol> correlationGroups, final Set<Expression> groupingSymbols, LanguageObject object, LinkedHashSet<Expression> invalid) { if (query.getFrom() == null) { return; } ElementCollectorVisitor ecv = new ElementCollectorVisitor(invalid) { public void visit(ElementSymbol obj) { if (obj.isExternalReference() && correlationGroups.contains(obj.getGroupSymbol()) && (groupingSymbols == null || !groupingSymbols.contains(obj))) { super.visit(obj); } } }; AggregateStopNavigator asn = new AggregateStopNavigator(ecv, groupingSymbols); object.acceptVisitor(asn); }
/** * This validation is more convoluted than needed since it is being run before rewrite/planning. * Ideally we would already have correlated references set on the subqueries. */ private void validateCorrelatedReferences(Query query, final List<GroupSymbol> correlationGroups, final Set<Expression> groupingSymbols, LanguageObject object, LinkedHashSet<Expression> invalid) { if (query.getFrom() == null) { return; } ElementCollectorVisitor ecv = new ElementCollectorVisitor(invalid) { public void visit(ElementSymbol obj) { if (obj.isExternalReference() && correlationGroups.contains(obj.getGroupSymbol()) && (groupingSymbols == null || !groupingSymbols.contains(obj))) { super.visit(obj); } } }; AggregateStopNavigator asn = new AggregateStopNavigator(ecv, groupingSymbols); object.acceptVisitor(asn); }
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 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 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); }
public void visit(AggregateSymbol obj) { if (!obj.isWindowed()) { // Visit aggregate symbol but do not dive into it's expression preVisitVisitor(obj); postVisitVisitor(obj); } else { super.visit(obj); } }
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); }
public void visit(AggregateSymbol obj) { if (!obj.isWindowed()) { // Visit aggregate symbol but do not dive into it's expression preVisitVisitor(obj); postVisitVisitor(obj); } else { super.visit(obj); } }
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); }
public void visit(AggregateSymbol obj) { if (!obj.isWindowed()) { // Visit aggregate symbol but do not dive into it's expression preVisitVisitor(obj); postVisitVisitor(obj); } else { super.visit(obj); } }