Skip to content

Commit

Permalink
[ESQL] Mark date_diff as requiring all three arguments (#108834) (#10…
Browse files Browse the repository at this point in the history
…8874)

Resolves #108383

I didn't see a good place to add a test for this; if there is one, let me know and I'm happy to add it.

This fixes a bug where we had incorrectly marked date_diff as having an optional argument, which resulted in an NPE when that argument was not provided. In fact, all three of date_diff's arguments are required. After this change, failing to provide one will cause a parse exception, as one would expect.
  • Loading branch information
not-napoleon committed May 21, 2024
1 parent 5c28758 commit 9bc00f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 6 additions & 0 deletions docs/changelog/108834.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 108834
summary: "[ESQL] Mark `date_diff` as requiring all three arguments"
area: ES|QL
type: bug
issues:
- 108383
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.elasticsearch.xpack.esql.expression.function.scalar.EsqlScalarFunction;
import org.elasticsearch.xpack.ql.InvalidArgumentException;
import org.elasticsearch.xpack.ql.expression.Expression;
import org.elasticsearch.xpack.ql.expression.function.OptionalArgument;
import org.elasticsearch.xpack.ql.tree.NodeInfo;
import org.elasticsearch.xpack.ql.tree.Source;
import org.elasticsearch.xpack.ql.type.DataType;
Expand Down Expand Up @@ -47,7 +46,7 @@
* in multiples of the unit specified in the first argument.
* If the second argument (start) is greater than the third argument (end), then negative values are returned.
*/
public class DateDiff extends EsqlScalarFunction implements OptionalArgument {
public class DateDiff extends EsqlScalarFunction {

public static final ZoneId UTC = ZoneId.of("Z");

Expand Down

0 comments on commit 9bc00f9

Please sign in to comment.