Skip to content

Commit bce6400

Browse files
Bugfix
1 parent d849ff9 commit bce6400

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/physical/HashJoinExec.java

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

88
package org.elasticsearch.xpack.esql.plan.physical;
99

10+
import org.elasticsearch.TransportVersions;
1011
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
1112
import org.elasticsearch.common.io.stream.StreamInput;
1213
import org.elasticsearch.common.io.stream.StreamOutput;
@@ -54,8 +55,9 @@ public HashJoinExec(
5455

5556
private HashJoinExec(StreamInput in) throws IOException {
5657
super(Source.readFrom((PlanStreamInput) in), in.readNamedWriteable(PhysicalPlan.class), in.readNamedWriteable(PhysicalPlan.class));
57-
// TODO: clean up, we used to read the match fields here.
58-
in.readNamedWriteableCollectionAsList(Attribute.class);
58+
if (in.getTransportVersion().onOrAfter(TransportVersions.ESQL_LOOKUP_JOIN_ON_EXPRESSION) == false) {
59+
in.readNamedWriteableCollectionAsList(Attribute.class);
60+
}
5961
this.leftFields = in.readNamedWriteableCollectionAsList(Attribute.class);
6062
this.rightFields = in.readNamedWriteableCollectionAsList(Attribute.class);
6163
this.addedFields = in.readNamedWriteableCollectionAsList(Attribute.class);
@@ -64,8 +66,9 @@ private HashJoinExec(StreamInput in) throws IOException {
6466
@Override
6567
public void writeTo(StreamOutput out) throws IOException {
6668
super.writeTo(out);
67-
// TODO: clean up, we used to read the match fields here.
68-
out.writeNamedWriteableCollection(leftFields);
69+
if (out.getTransportVersion().onOrAfter(TransportVersions.ESQL_LOOKUP_JOIN_ON_EXPRESSION) == false) {
70+
out.writeNamedWriteableCollection(leftFields);
71+
}
6972
out.writeNamedWriteableCollection(leftFields);
7073
out.writeNamedWriteableCollection(rightFields);
7174
out.writeNamedWriteableCollection(addedFields);

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/enrich/LookupFromIndexOperatorTests.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
import java.util.Collections;
9292
import java.util.HashSet;
9393
import java.util.List;
94+
import java.util.Locale;
9495
import java.util.Map;
9596
import java.util.Set;
9697
import java.util.stream.LongStream;
@@ -448,12 +449,12 @@ private AbstractLookupService.LookupShardContextFactory lookupShardContextFactor
448449
};
449450
String suffix = (operation == null) ? "" : ("_right");
450451
StringBuilder props = new StringBuilder();
451-
props.append(String.format("\"match0%s\": { \"type\": \"long\" }", suffix));
452+
props.append(String.format(Locale.ROOT, "\"match0%s\": { \"type\": \"long\" }", suffix));
452453
if (numberOfJoinColumns == 2) {
453-
props.append(String.format(", \"match1%s\": { \"type\": \"long\" }", suffix));
454+
props.append(String.format(Locale.ROOT, ", \"match1%s\": { \"type\": \"long\" }", suffix));
454455
}
455456
props.append(", \"lkwd\": { \"type\": \"keyword\" }, \"lint\": { \"type\": \"integer\" }");
456-
String mapping = String.format("{\n \"doc\": { \"properties\": { %s } }\n}", props.toString());
457+
String mapping = String.format(Locale.ROOT, "{\n \"doc\": { \"properties\": { %s } }\n}", props.toString());
457458
MapperService mapperService = mapperHelper.createMapperService(mapping);
458459
DirectoryReader reader = DirectoryReader.open(lookupIndexDirectory);
459460
SearchExecutionContext executionCtx = mapperHelper.createSearchExecutionContext(mapperService, newSearcher(reader));

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/LogicalPlanOptimizerTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6803,7 +6803,7 @@ public void testReplaceStringCasingWithInsensitiveEqualsLowerTrue() {
68036803
public void testReplaceStringCasingWithInsensitiveEqualsEquals() {
68046804
for (var fn : List.of("TO_LOWER", "TO_UPPER")) {
68056805
var value = fn.equals("TO_LOWER") ? fn.toLowerCase(Locale.ROOT) : fn.toUpperCase(Locale.ROOT);
6806-
value += "�✈��"; // these should not cause folding, they're not in the upper/lower char class
6806+
value += "🐔✈🔥🎉"; // these should not cause folding, they're not in the upper/lower char class
68076807
var plan = optimizedPlan("FROM test | WHERE " + fn + "(first_name) == \"" + value + "\"");
68086808
var limit = as(plan, Limit.class);
68096809
var filter = as(limit.child(), Filter.class);
@@ -6818,7 +6818,7 @@ public void testReplaceStringCasingWithInsensitiveEqualsEquals() {
68186818
public void testReplaceStringCasingWithInsensitiveEqualsNotEquals() {
68196819
for (var fn : List.of("TO_LOWER", "TO_UPPER")) {
68206820
var value = fn.equals("TO_LOWER") ? fn.toLowerCase(Locale.ROOT) : fn.toUpperCase(Locale.ROOT);
6821-
value += "�✈��"; // these should not cause folding, they're not in the upper/lower char class
6821+
value += "🐔✈🔥🎉"; // these should not cause folding, they're not in the upper/lower char class
68226822
var plan = optimizedPlan("FROM test | WHERE " + fn + "(first_name) != \"" + value + "\"");
68236823
var limit = as(plan, Limit.class);
68246824
var filter = as(limit.child(), Filter.class);

0 commit comments

Comments
 (0)