Skip to content

Commit a036aa6

Browse files
bugfix
1 parent 00b41ed commit a036aa6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/enrich/LookupFromIndexOperator.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.elasticsearch.xpack.esql.core.tree.Source;
2828

2929
import java.io.IOException;
30+
import java.util.ArrayList;
3031
import java.util.Iterator;
3132
import java.util.List;
3233
import java.util.Objects;
@@ -124,11 +125,16 @@ public LookupFromIndexOperator(
124125
@Override
125126
protected void performAsync(Page inputPage, ActionListener<OngoingJoin> listener) {
126127
Block[] inputBlockArray = new Block[matchFields.size()];
128+
List<MatchConfig> newMatchFields = new ArrayList<>();
127129
for (int i = 0; i < matchFields.size(); i++) {
128130
MatchConfig matchField = matchFields.get(i);
129131
int inputChannel = matchField.channel();
130132
final Block inputBlock = inputPage.getBlock(inputChannel);
131133
inputBlockArray[i] = inputBlock;
134+
// the matchFields we have are indexed by the input channel on the left side of the join
135+
// create a new MatchConfig that uses the field name and type from the matchField
136+
// but the new channel index in the inputBlockArray
137+
newMatchFields.add(new MatchConfig(matchField.fieldName(), i, matchField.type()));
132138
}
133139
// we only add to the totalRows once, so we can use the first block
134140
totalRows += inputPage.getBlock(0).getTotalValueCount();
@@ -137,7 +143,7 @@ protected void performAsync(Page inputPage, ActionListener<OngoingJoin> listener
137143
sessionId,
138144
lookupIndex,
139145
lookupIndexPattern,
140-
matchFields,
146+
newMatchFields,
141147
new Page(inputBlockArray),
142148
loadFields,
143149
source

0 commit comments

Comments
 (0)