Skip to content

Commit 0404e21

Browse files
committed
add expressions
1 parent c792014 commit 0404e21

File tree

1 file changed

+6
-13
lines changed
  • x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression

1 file changed

+6
-13
lines changed

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/Expressions.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,6 @@ public static List<Attribute> asAttributes(List<? extends NamedExpression> named
3535
return list;
3636
}
3737

38-
public static AttributeMap<Expression> asAttributeMap(List<? extends NamedExpression> named) {
39-
if (named.isEmpty()) {
40-
return AttributeMap.emptyAttributeMap();
41-
}
42-
43-
AttributeMap<Expression> map = new AttributeMap<>();
44-
for (NamedExpression exp : named) {
45-
map.add(exp.toAttribute(), exp);
46-
}
47-
return map;
48-
}
49-
5038
public static boolean anyMatch(List<? extends Expression> exps, Predicate<? super Expression> predicate) {
5139
for (Expression exp : exps) {
5240
if (exp.anyMatch(predicate)) {
@@ -121,10 +109,15 @@ public static AttributeSet references(List<? extends Expression> exps) {
121109
return AttributeSet.EMPTY;
122110
}
123111

124-
AttributeSet set = new AttributeSet();
112+
int size = 0;
113+
for (Expression exp : exps) {
114+
size += exp.references().size();
115+
}
116+
AttributeSet set = new AttributeSet(size);
125117
for (Expression exp : exps) {
126118
set.addAll(exp.references());
127119
}
120+
128121
return set;
129122
}
130123

0 commit comments

Comments
 (0)