File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 1+ pr : 126578
2+ summary : Retrieve token text only when necessary
3+ area : ES|QL
4+ type : bug
5+ issues : []
Original file line number Diff line number Diff line change @@ -144,10 +144,10 @@ public static String text(ParseTree node) {
144144 */
145145 public static String nameOrPosition (Token token ) {
146146 int tokenType = token .getType ();
147- String s = token . getText ();
147+ // Retrieve text from the token only when necessary, when the token type is known.
148148 return switch (tokenType ) {
149- case EsqlBaseLexer .NAMED_OR_POSITIONAL_PARAM -> s .substring (SINGLE_PARAM );
150- case EsqlBaseLexer .NAMED_OR_POSITIONAL_DOUBLE_PARAMS -> s .substring (DOUBLE_PARAM );
149+ case EsqlBaseLexer .NAMED_OR_POSITIONAL_PARAM -> token . getText () .substring (SINGLE_PARAM );
150+ case EsqlBaseLexer .NAMED_OR_POSITIONAL_DOUBLE_PARAMS -> token . getText () .substring (DOUBLE_PARAM );
151151 default -> EMPTY ;
152152 };
153153 }
You can’t perform that action at this time.
0 commit comments