Skip to content

Commit

Permalink
Update enrich
Browse files Browse the repository at this point in the history
  • Loading branch information
nik9000 committed Nov 20, 2023
1 parent 947558f commit 2c8ec19
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,9 @@ private void doLookup(
};
List<Operator> intermediateOperators = new ArrayList<>(extractFields.size() + 2);
final ElementType[] mergingTypes = new ElementType[extractFields.size()];
// extract-field operators

// load the fields
List<ValuesSourceReaderOperator.FieldInfo> fields = new ArrayList<>(extractFields.size());
for (int i = 0; i < extractFields.size(); i++) {
NamedExpression extractField = extractFields.get(i);
final ElementType elementType = LocalExecutionPlanner.toElementType(extractField.dataType());
Expand All @@ -267,18 +269,16 @@ private void doLookup(
extractField instanceof Alias a ? ((NamedExpression) a.child()).name() : extractField.name(),
EsqlDataTypes.isUnsupported(extractField.dataType())
);
intermediateOperators.add(
new ValuesSourceReaderOperator(
blockFactory,
List.of(new ValuesSourceReaderOperator.FieldInfo(extractField.name(), loaders)),
List.of(searchContext.searcher().getIndexReader()),
0
)
);
fields.add(new ValuesSourceReaderOperator.FieldInfo(extractField.name(), loaders));
}
intermediateOperators.add(
new ValuesSourceReaderOperator(blockFactory, fields, List.of(searchContext.searcher().getIndexReader()), 0)
);

// drop docs block
intermediateOperators.add(droppingBlockOperator(extractFields.size() + 2, 0));
boolean singleLeaf = searchContext.searcher().getLeafContexts().size() == 1;

// merging field-values by position
final int[] mergingChannels = IntStream.range(0, extractFields.size()).map(i -> i + 1).toArray();
intermediateOperators.add(
Expand Down

0 comments on commit 2c8ec19

Please sign in to comment.