|
118 | 118 | import org.elasticsearch.xpack.esql.session.Configuration; |
119 | 119 |
|
120 | 120 | import java.util.ArrayList; |
121 | | -import java.util.HashMap; |
122 | | -import java.util.HashSet; |
123 | | -import java.util.LinkedHashMap; |
124 | 121 | import java.util.List; |
125 | 122 | import java.util.Map; |
126 | 123 | import java.util.Objects; |
@@ -502,8 +499,8 @@ private PhysicalOperation planGrok(GrokExec grok, LocalExecutionPlannerContext c |
502 | 499 | Layout.Builder layoutBuilder = source.layout.builder(); |
503 | 500 | List<Attribute> extractedFields = grok.extractedFields(); |
504 | 501 | layoutBuilder.append(extractedFields); |
505 | | - Map<String, Integer> fieldToPos = new HashMap<>(extractedFields.size()); |
506 | | - Map<String, ElementType> fieldToType = new HashMap<>(extractedFields.size()); |
| 502 | + Map<String, Integer> fieldToPos = Maps.newHashMapWithExpectedSize(extractedFields.size()); |
| 503 | + Map<String, ElementType> fieldToType = Maps.newHashMapWithExpectedSize(extractedFields.size()); |
507 | 504 | ElementType[] types = new ElementType[extractedFields.size()]; |
508 | 505 | List<Attribute> extractedFieldsFromPattern = grok.pattern().extractedFields(); |
509 | 506 | for (int i = 0; i < extractedFields.size(); i++) { |
@@ -560,7 +557,8 @@ private PhysicalOperation planEnrich(EnrichExec enrich, LocalExecutionPlannerCon |
560 | 557 | private PhysicalOperation planRerank(RerankExec rerank, LocalExecutionPlannerContext context) { |
561 | 558 | PhysicalOperation source = plan(rerank.child(), context); |
562 | 559 |
|
563 | | - Map<ColumnInfoImpl, EvalOperator.ExpressionEvaluator.Factory> rerankFieldsEvaluatorSuppliers = new LinkedHashMap<>(); |
| 560 | + Map<ColumnInfoImpl, EvalOperator.ExpressionEvaluator.Factory> rerankFieldsEvaluatorSuppliers = Maps |
| 561 | + .newLinkedHashMapWithExpectedSize(rerank.rerankFields().size()); |
564 | 562 |
|
565 | 563 | for (var rerankField : rerank.rerankFields()) { |
566 | 564 | rerankFieldsEvaluatorSuppliers.put( |
@@ -735,24 +733,13 @@ private PhysicalOperation planProject(ProjectExec project, LocalExecutionPlanner |
735 | 733 | List<Integer> projectionList = new ArrayList<>(projections.size()); |
736 | 734 |
|
737 | 735 | Layout.Builder layout = new Layout.Builder(); |
738 | | - Map<Integer, Layout.ChannelSet> inputChannelToOutputIds = Maps.newHashMapWithExpectedSize(projections.size()); |
739 | 736 | for (NamedExpression ne : projections) { |
740 | 737 | NameId inputId = ne instanceof Alias a ? ((NamedExpression) a.child()).id() : ne.id(); |
741 | 738 | Layout.ChannelAndType input = source.layout.get(inputId); |
742 | 739 | if (input == null) { |
743 | 740 | throw new IllegalStateException("can't find input for [" + ne + "]"); |
744 | 741 | } |
745 | | - Layout.ChannelSet channelSet = inputChannelToOutputIds.get(input.channel()); |
746 | | - if (channelSet == null) { |
747 | | - channelSet = new Layout.ChannelSet(new HashSet<>(), input.type()); |
748 | | - channelSet.nameIds().add(ne.id()); |
749 | | - layout.append(channelSet); |
750 | | - } else { |
751 | | - channelSet.nameIds().add(ne.id()); |
752 | | - } |
753 | | - if (channelSet.type() != input.type()) { |
754 | | - throw new IllegalArgumentException("type mismatch for aliases"); |
755 | | - } |
| 742 | + layout.append(ne); |
756 | 743 | projectionList.add(input.channel()); |
757 | 744 | } |
758 | 745 |
|
|
0 commit comments