Skip to content

Commit 64e2079

Browse files
committed
Change wording inm error message function named arguments to named parameters since it has a broader usage.
1 parent 782dd5f commit 64e2079

File tree

2 files changed

+5
-28
lines changed

2 files changed

+5
-28
lines changed

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -651,11 +651,7 @@ public MapExpression visitMapExpression(EsqlBaseParser.MapExpressionContext ctx)
651651
EsqlBaseParser.StringContext stringCtx = entry.string();
652652
String key = unquote(stringCtx.QUOTED_STRING().getText()); // key is case-sensitive
653653
if (key.isBlank()) {
654-
throw new ParsingException(
655-
source(ctx),
656-
"Invalid named parameter [{}], empty key is not supported",
657-
entry.getText()
658-
);
654+
throw new ParsingException(source(ctx), "Invalid named parameter [{}], empty key is not supported", entry.getText());
659655
}
660656
if (names.contains(key)) {
661657
throw new ParsingException(source(ctx), "Duplicated named parameters with the same name [{}] is not supported", key);
@@ -670,11 +666,7 @@ public MapExpression visitMapExpression(EsqlBaseParser.MapExpressionContext ctx)
670666
namedArgs.add(l);
671667
names.add(key);
672668
} else {
673-
throw new ParsingException(
674-
source(ctx),
675-
"Invalid named parameter [{}], only constant value is supported",
676-
entryText
677-
);
669+
throw new ParsingException(source(ctx), "Invalid named parameter [{}], only constant value is supported", entryText);
678670
}
679671
}
680672
return new MapExpression(Source.EMPTY, namedArgs);

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/parser/StatementParserTests.java

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3003,12 +3003,7 @@ public void testNamedFunctionNamedParametersMapWithNULL() {
30033003
String error = command.getValue();
30043004
expectError(
30053005
LoggerMessageFormat.format(null, "from test | " + cmd, "fn(f1, {\"option\":null})"),
3006-
LoggerMessageFormat.format(
3007-
null,
3008-
"line 1:{}: {}",
3009-
error,
3010-
"Invalid named parameter [\"option\":null], NULL is not supported"
3011-
)
3006+
LoggerMessageFormat.format(null, "line 1:{}: {}", error, "Invalid named parameter [\"option\":null], NULL is not supported")
30123007
);
30133008
}
30143009
}
@@ -3029,21 +3024,11 @@ public void testNamedFunctionNamedParametersMapWithEmptyKey() {
30293024
String error = command.getValue();
30303025
expectError(
30313026
LoggerMessageFormat.format(null, "from test | " + cmd, "fn(f1, {\"\":1})"),
3032-
LoggerMessageFormat.format(
3033-
null,
3034-
"line 1:{}: {}",
3035-
error,
3036-
"Invalid named parameter [\"\":1], empty key is not supported"
3037-
)
3027+
LoggerMessageFormat.format(null, "line 1:{}: {}", error, "Invalid named parameter [\"\":1], empty key is not supported")
30383028
);
30393029
expectError(
30403030
LoggerMessageFormat.format(null, "from test | " + cmd, "fn(f1, {\" \":1})"),
3041-
LoggerMessageFormat.format(
3042-
null,
3043-
"line 1:{}: {}",
3044-
error,
3045-
"Invalid named parameter [\" \":1], empty key is not supported"
3046-
)
3031+
LoggerMessageFormat.format(null, "line 1:{}: {}", error, "Invalid named parameter [\" \":1], empty key is not supported")
30473032
);
30483033
}
30493034
}

0 commit comments

Comments
 (0)