Skip to content

Commit 0464717

Browse files
committed
Presize sets
1 parent 95cf145 commit 0464717

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/PlanConsistencyChecker.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
package org.elasticsearch.xpack.esql.optimizer.rules;
99

10+
import org.elasticsearch.common.util.set.Sets;
1011
import org.elasticsearch.xpack.esql.common.Failures;
1112
import org.elasticsearch.xpack.esql.core.expression.Attribute;
1213
import org.elasticsearch.xpack.esql.core.expression.AttributeSet;
@@ -15,9 +16,6 @@
1516
import org.elasticsearch.xpack.esql.plan.logical.BinaryPlan;
1617
import org.elasticsearch.xpack.esql.plan.physical.BinaryExec;
1718

18-
import java.util.HashSet;
19-
import java.util.Set;
20-
2119
import static org.elasticsearch.xpack.esql.common.Failure.fail;
2220

2321
public class PlanConsistencyChecker {
@@ -50,8 +48,8 @@ public static void checkPlan(QueryPlan<?> p, Failures failures) {
5048
checkMissing(p, p.references(), p.inputSet(), "missing references", failures);
5149
}
5250

53-
Set<String> outputAttributeNames = new HashSet<>();
54-
Set<NameId> outputAttributeIds = new HashSet<>();
51+
var outputAttributeNames = Sets.<String>newHashSetWithExpectedSize(p.output().size());
52+
var outputAttributeIds = Sets.<NameId>newHashSetWithExpectedSize(p.output().size());
5553
for (Attribute outputAttr : p.output()) {
5654
if (outputAttributeNames.add(outputAttr.name()) == false || outputAttributeIds.add(outputAttr.id()) == false) {
5755
failures.add(

0 commit comments

Comments
 (0)