Skip to content

Commit a34eeb7

Browse files
committed
Remove named function arg from functions other than table functions
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
1 parent c05a58c commit a34eeb7

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

ppl/src/main/antlr/OpenSearchPPLParser.g4

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ tableSource
518518
;
519519

520520
tableFunction
521-
: qualifiedName LT_PRTHS functionArgs RT_PRTHS
521+
: qualifiedName LT_PRTHS namedFunctionArgs RT_PRTHS
522522
;
523523

524524
// fields
@@ -593,10 +593,17 @@ functionArgs
593593
: (functionArg (COMMA functionArg)*)?
594594
;
595595

596+
namedFunctionArgs
597+
: (namedFunctionArg (COMMA namedFunctionArg)*)?
598+
;
599+
596600
functionArg
597-
: (ident EQUAL)? functionArgExpression
601+
: functionArgExpression
598602
;
599603

604+
namedFunctionArg
605+
: (ident EQUAL)? functionArgExpression
606+
;
600607

601608
functionArgExpression
602609
: lambda

ppl/src/main/java/org/opensearch/sql/ppl/parser/AstBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,8 @@ public UnresolvedPlan visitTableSourceClause(TableSourceClauseContext ctx) {
551551
@Override
552552
public UnresolvedPlan visitTableFunction(TableFunctionContext ctx) {
553553
ImmutableList.Builder<UnresolvedExpression> builder = ImmutableList.builder();
554-
ctx.functionArgs()
555-
.functionArg()
554+
ctx.namedFunctionArgs()
555+
.namedFunctionArg()
556556
.forEach(
557557
arg -> {
558558
String argName = (arg.ident() != null) ? arg.ident().getText() : null;

0 commit comments

Comments
 (0)