Skip to content

Commit f804232

Browse files
committed
Add more testing advice to the guide to adding a new function.
1 parent b1047ec commit f804232

File tree

1 file changed

+5
-3
lines changed
  • x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar

1 file changed

+5
-3
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/package-info.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,17 @@
120120
* Rerun the {@code CsvTests}. They should find your function and maybe even pass. Add a
121121
* few more tests in the csv-spec tests. They run quickly so it isn't a big deal having
122122
* half a dozen of them per function. In fact, it's useful to add more complex combinations
123-
* of things here, just to catch any accidental strange interactions. For example, it is
124-
* probably a good idea to have your function passes as a parameter to another function
123+
* of things here, just to catch any accidental strange interactions. For example, have
124+
* your function take its input from an index like {@code FROM employees | EVAL foo=MY_FUNCTION(emp_no)}.
125+
* It's probably a good idea to have your function passed as a parameter to another function
125126
* like {@code EVAL foo=MOST(0, MY_FUNCTION(emp_no))}. And likely useful to try the reverse
126127
* like {@code EVAL foo=MY_FUNCTION(MOST(languages + 10000, emp_no)}.
127128
* </li>
128129
* <li>
129130
* Now it's time to make a unit test! The infrastructure for these is under some flux at
130-
* the moment, but it's good to extend from {@code AbstractScalarFunctionTestCase}. All of
131+
* the moment, but it's good to extend {@code AbstractScalarFunctionTestCase}. All of
131132
* these tests are parameterized and expect to spend some time finding good parameters.
133+
* Also add serialization tests that extend {@code AbstractExpressionSerializationTests<>}.
132134
* </li>
133135
* <li>
134136
* Once you are happy with the tests run the auto formatter:

0 commit comments

Comments
 (0)