Skip to content

Commit e6af95e

Browse files
More fixes
1 parent 42dc6e9 commit e6af95e

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

docs/changelog/121787.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pr: 121787
2-
summary: Initial commit
2+
summary: Added optional parameters to QSTR ES|QL function
33
area: Search
44
type: feature
55
issues: []

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/fulltext/QueryStringTests.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
import org.elasticsearch.xpack.esql.core.type.DataType;
1919
import org.elasticsearch.xpack.esql.expression.function.FunctionName;
2020
import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier;
21+
import org.elasticsearch.xpack.esql.io.stream.PlanStreamOutput;
2122

2223
import java.util.ArrayList;
2324
import java.util.List;
2425
import java.util.function.Supplier;
2526

27+
import static org.elasticsearch.xpack.esql.SerializationTestUtils.serializeDeserialize;
2628
import static org.elasticsearch.xpack.esql.core.type.DataType.BOOLEAN;
2729
import static org.elasticsearch.xpack.esql.core.type.DataType.KEYWORD;
2830
import static org.elasticsearch.xpack.esql.core.type.DataType.UNSUPPORTED;
@@ -88,8 +90,18 @@ public void testFold() {
8890
// Query string cannot be folded.
8991
}
9092

93+
/**
94+
* Copy of the overridden method that doesn't check for children size, as the {@code options} child isn't serialized for Query String.
95+
*/
9196
@Override
92-
public void testSerializationOfSimple() {
93-
// Intentionally not tested here.
97+
protected Expression serializeDeserializeExpression(Expression expression) {
98+
Expression newExpression = serializeDeserialize(
99+
expression,
100+
PlanStreamOutput::writeNamedWriteable,
101+
in -> in.readNamedWriteable(Expression.class),
102+
testCase.getConfiguration() // The configuration query should be == to the source text of the function for this to work
103+
);
104+
// Fields use synthetic sources, which can't be serialized. So we use the originals instead.
105+
return newExpression.replaceChildren(expression.children());
94106
}
95107
}

0 commit comments

Comments
 (0)