MCPcopy Create free account
hub / github.com/apache/impala / collect

Method collect

fe/src/main/java/org/apache/impala/common/TreeNode.java:117–132  ·  view source on GitHub ↗

Add all nodes in the tree that satisfy 'predicate' to the list 'matches' This node is checked first, followed by its children in order. If the node itself matches, the children are skipped.

(
      Predicate<? super C> predicate, Collection<D> matches)

Source from the content-addressed store, hash-verified

115 * itself matches, the children are skipped.
116 */
117 @SuppressWarnings("unchecked")
118 public <C extends TreeNode<NodeType>, D extends C> void collect(
119 Predicate<? super C> predicate, Collection<D> matches) {
120 // TODO: the semantics of this function are very strange. contains()
121 // checks using .equals() on the nodes. In the case of literals, slotrefs
122 // and maybe others, two different tree node objects can be equal and
123 // this function would only return one of them. This is not intuitive.
124 // We rely on these semantics to not have duplicate nodes. Investigate this.
125 if (predicate.apply((C) this) && !matches.contains(this)) {
126 matches.add((D) this);
127 return;
128 }
129 if (shouldCollectRecursively()) {
130 for (NodeType child: children_) child.collect(predicate, matches);
131 }
132 }
133
134 /**
135 * Add all nodes in the tree that are of class 'cl' to the list 'matches'.

Callers 15

createSortTupleInfoMethod · 0.95
collectAggExprsMethod · 0.95
buildAggregateExprsMethod · 0.95
createAnalyticInfoMethod · 0.95
InsertEventMethod · 0.80
fullColumnsMethod · 0.80
testOrderByAliasMethod · 0.80
addRoleMethod · 0.80
initMethod · 0.80
prepareMergeInsertMethod · 0.80

Calls 4

applyMethod · 0.65
containsMethod · 0.45
addMethod · 0.45

Tested by 15

fullColumnsMethod · 0.64
testOrderByAliasMethod · 0.64
addRoleMethod · 0.64
initMethod · 0.64
prepareMergeInsertMethod · 0.64
prepareSelectListMethod · 0.64
flagsToArgsMethod · 0.64
mergeFlagsMethod · 0.64
flagsToArgsMethod · 0.64
mergeFlagsMethod · 0.64
getImpalaShellEnvMethod · 0.64