|
18 | 18 | import org.elasticsearch.xpack.esql.core.type.DataType; |
19 | 19 | import org.elasticsearch.xpack.esql.expression.function.FunctionName; |
20 | 20 | import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier; |
| 21 | +import org.elasticsearch.xpack.esql.io.stream.PlanStreamOutput; |
21 | 22 |
|
22 | 23 | import java.util.ArrayList; |
23 | 24 | import java.util.List; |
24 | 25 | import java.util.function.Supplier; |
25 | 26 |
|
| 27 | +import static org.elasticsearch.xpack.esql.SerializationTestUtils.serializeDeserialize; |
26 | 28 | import static org.elasticsearch.xpack.esql.core.type.DataType.BOOLEAN; |
27 | 29 | import static org.elasticsearch.xpack.esql.core.type.DataType.KEYWORD; |
28 | 30 | import static org.elasticsearch.xpack.esql.core.type.DataType.UNSUPPORTED; |
@@ -88,8 +90,18 @@ public void testFold() { |
88 | 90 | // Query string cannot be folded. |
89 | 91 | } |
90 | 92 |
|
| 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 | + */ |
91 | 96 | @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()); |
94 | 106 | } |
95 | 107 | } |
0 commit comments