Browse Source

ESQL: Build `functionName` on the fly (#134395)

This removes a member variable we initiaized to the UPPER CASE name of
the class in every function. This was costing us a couple dozen bytes
for every function invocation in the plan in ESQL. Fine if there are 10
functions, annoying if there are thousands.
Nik Everett 1 month ago
parent
commit
2769584463

+ 1 - 4
x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/function/Function.java

@@ -21,9 +21,6 @@ import java.util.StringJoiner;
  * {@code EVAL}) or aggregation functions ({@code STATS}).
  */
 public abstract class Function extends Expression {
-
-    private final String functionName = getClass().getSimpleName().toUpperCase(Locale.ROOT);
-
     // TODO: Functions supporting distinct should add a dedicated constructor Location, List<Expression>, boolean
     protected Function(Source source, List<Expression> children) {
         super(source, children);
@@ -34,7 +31,7 @@ public abstract class Function extends Expression {
     }
 
     public String functionName() {
-        return functionName;
+        return getClass().getSimpleName().toUpperCase(Locale.ROOT);
     }
 
     @Override