Browse Source

ESQL: Fix the FIRST function name (#132503)

I made a mistake in #132469
Nik Everett 2 months ago
parent
commit
fd057bf6aa

+ 5 - 1
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/ExpressionBuilder.java

@@ -643,7 +643,11 @@ public abstract class ExpressionBuilder extends IdentifierBuilder {
     }
 
     private String functionName(EsqlBaseParser.FunctionNameContext ctx) {
-        TerminalNode first = ctx.LAST();
+        /*
+         * FIRST and LAST are valid function names AND tokens used in `NULLS LAST`.
+         * So we have to have special handling for them here.
+         */
+        TerminalNode first = ctx.FIRST();
         if (first != null) {
             return first.getText();
         }