Skip to content

Commit db5f8c5

Browse files
WIP POC for expression join
1 parent fabf32c commit db5f8c5

File tree

38 files changed

+1127
-98
lines changed

38 files changed

+1127
-98
lines changed

.idea/runConfigurations/Debug_Elasticsearch__node_2_.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/Debug_Elasticsearch__node_3_.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ static TransportVersion def(int id) {
359359
public static final TransportVersion SEMANTIC_QUERY_MULTIPLE_INFERENCE_IDS = def(9_150_0_00);
360360
public static final TransportVersion ESQL_LOOKUP_JOIN_PRE_JOIN_FILTER = def(9_151_0_00);
361361
public static final TransportVersion INFERENCE_API_DISABLE_EIS_RATE_LIMITING = def(9_152_0_00);
362+
public static final TransportVersion ESQL_LOOKUP_JOIN_ON_EXPRESSION = def(9_143_0_00);
362363

363364
/*
364365
* STOP! READ THIS FIRST! No, really,

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/lookup/QueryList.java

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public final Query getQuery(int position) {
125125
* Returns the query at the given position.
126126
*/
127127
@Nullable
128-
abstract Query doGetQuery(int position, int firstValueIndex, int valueCount);
128+
public abstract Query doGetQuery(int position, int firstValueIndex, int valueCount);
129129

130130
private Query wrapSingleValueQuery(Query query) {
131131
assert onlySingleValueParams != null : "Requested to wrap single value query without single value params";
@@ -159,13 +159,8 @@ private Query wrapSingleValueQuery(Query query) {
159159
* using only the {@link ElementType} of the {@link Block} to determine the
160160
* query.
161161
*/
162-
public static QueryList rawTermQueryList(
163-
MappedFieldType field,
164-
SearchExecutionContext searchExecutionContext,
165-
AliasFilter aliasFilter,
166-
Block block
167-
) {
168-
IntFunction<Object> blockToJavaObject = switch (block.elementType()) {
162+
public static IntFunction<Object> createBlockValueReader(Block block) {
163+
return switch (block.elementType()) {
169164
case BOOLEAN -> {
170165
BooleanBlock booleanBlock = (BooleanBlock) block;
171166
yield booleanBlock::getBoolean;
@@ -196,7 +191,20 @@ public static QueryList rawTermQueryList(
196191
case AGGREGATE_METRIC_DOUBLE -> throw new IllegalArgumentException("can't read values from [aggregate metric double] block");
197192
case UNKNOWN -> throw new IllegalArgumentException("can't read values from [" + block + "]");
198193
};
199-
return new TermQueryList(field, searchExecutionContext, aliasFilter, block, null, blockToJavaObject);
194+
}
195+
196+
/**
197+
* Returns a list of term queries for the given field and the input block
198+
* using only the {@link ElementType} of the {@link Block} to determine the
199+
* query.
200+
*/
201+
public static QueryList rawTermQueryList(
202+
MappedFieldType field,
203+
SearchExecutionContext searchExecutionContext,
204+
AliasFilter aliasFilter,
205+
Block block
206+
) {
207+
return new TermQueryList(field, searchExecutionContext, aliasFilter, block, null, createBlockValueReader(block));
200208
}
201209

202210
/**
@@ -297,7 +305,7 @@ public TermQueryList onlySingleValues(Warnings warnings, String multiValueWarnin
297305
}
298306

299307
@Override
300-
Query doGetQuery(int position, int firstValueIndex, int valueCount) {
308+
public Query doGetQuery(int position, int firstValueIndex, int valueCount) {
301309
return switch (valueCount) {
302310
case 0 -> null;
303311
case 1 -> field.termQuery(blockValueReader.apply(firstValueIndex), searchExecutionContext);
@@ -360,7 +368,7 @@ public DateNanosQueryList onlySingleValues(Warnings warnings, String multiValueW
360368
}
361369

362370
@Override
363-
Query doGetQuery(int position, int firstValueIndex, int valueCount) {
371+
public Query doGetQuery(int position, int firstValueIndex, int valueCount) {
364372
return switch (valueCount) {
365373
case 0 -> null;
366374
case 1 -> dateFieldType.equalityQuery(blockValueReader.apply(firstValueIndex), searchExecutionContext);
@@ -412,7 +420,7 @@ public GeoShapeQueryList onlySingleValues(Warnings warnings, String multiValueWa
412420
}
413421

414422
@Override
415-
Query doGetQuery(int position, int firstValueIndex, int valueCount) {
423+
public Query doGetQuery(int position, int firstValueIndex, int valueCount) {
416424
return switch (valueCount) {
417425
case 0 -> null;
418426
case 1 -> shapeQuery.apply(firstValueIndex);

0 commit comments

Comments
 (0)