浏览代码

ESQL: Fix the FIRST function name (#132503)

I made a mistake in #132469
Nik Everett 2 月之前
父节点
当前提交
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) {
     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) {
         if (first != null) {
             return first.getText();
             return first.getText();
         }
         }