|
10 | 10 | import com.carrotsearch.randomizedtesting.annotations.Name; |
11 | 11 | import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; |
12 | 12 |
|
| 13 | +import org.elasticsearch.xpack.esql.action.EsqlCapabilities; |
13 | 14 | import org.elasticsearch.xpack.esql.core.expression.Expression; |
14 | 15 | import org.elasticsearch.xpack.esql.core.tree.Source; |
15 | 16 | import org.elasticsearch.xpack.esql.expression.function.FunctionName; |
16 | 17 | import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier; |
17 | | -import org.elasticsearch.xpack.esql.io.stream.PlanStreamOutput; |
| 18 | +import org.junit.BeforeClass; |
18 | 19 |
|
19 | 20 | import java.util.ArrayList; |
20 | 21 | import java.util.List; |
21 | 22 | import java.util.function.Supplier; |
22 | 23 |
|
23 | | -import static org.elasticsearch.xpack.esql.SerializationTestUtils.serializeDeserialize; |
24 | 24 | import static org.elasticsearch.xpack.esql.core.type.DataType.BOOLEAN; |
25 | 25 | import static org.elasticsearch.xpack.esql.core.type.DataType.DOUBLE; |
26 | 26 | import static org.hamcrest.Matchers.equalTo; |
27 | 27 |
|
28 | 28 | @FunctionName("score") |
29 | 29 | public class ScoreTests extends AbstractMatchFullTextFunctionTests { |
30 | 30 |
|
| 31 | + @BeforeClass |
| 32 | + public static void init() { |
| 33 | + assumeTrue("can run this only when score() function is enabled", EsqlCapabilities.Cap.SCORE_FUNCTION.isEnabled()); |
| 34 | + } |
| 35 | + |
31 | 36 | public ScoreTests(@Name("TestCase") Supplier<TestCaseSupplier.TestCase> testCaseSupplier) { |
32 | 37 | this.testCase = testCaseSupplier.get(); |
33 | 38 | } |
@@ -55,18 +60,4 @@ protected Expression build(Source source, List<Expression> args) { |
55 | 60 | return new Score(source, args.getFirst()); |
56 | 61 | } |
57 | 62 |
|
58 | | - /** |
59 | | - * Copy of the overridden method that doesn't check for children size, as the {@code options} child isn't serialized in Match. |
60 | | - */ |
61 | | - @Override |
62 | | - protected Expression serializeDeserializeExpression(Expression expression) { |
63 | | - Expression newExpression = serializeDeserialize( |
64 | | - expression, |
65 | | - PlanStreamOutput::writeNamedWriteable, |
66 | | - in -> in.readNamedWriteable(Expression.class), |
67 | | - testCase.getConfiguration() // The configuration query should be == to the source text of the function for this to work |
68 | | - ); |
69 | | - // Fields use synthetic sources, which can't be serialized. So we use the originals instead. |
70 | | - return newExpression.replaceChildren(expression.children()); |
71 | | - } |
72 | 63 | } |
0 commit comments