Skip to content

Commit

Permalink
update expand antlr command (#918)
Browse files Browse the repository at this point in the history
Signed-off-by: YANGDB <[email protected]>
  • Loading branch information
YANG-DB authored Nov 15, 2024
1 parent ec337b4 commit 06f1420
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ppl-spark-integration/src/main/antlr4/OpenSearchPPLLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ ISPRESENT: 'ISPRESENT';
BETWEEN: 'BETWEEN';
CIDRMATCH: 'CIDRMATCH';

// Geo Loction
GEOIP: 'GEOIP';

// FLOWCONTROL FUNCTIONS
IFNULL: 'IFNULL';
NULLIF: 'NULLIF';
Expand Down
11 changes: 11 additions & 0 deletions ppl-spark-integration/src/main/antlr4/OpenSearchPPLParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ valueExpression
| positionFunction # positionFunctionCall
| caseFunction # caseExpr
| timestampFunction # timestampFunctionCall
| geoipFunction # geoFunctionCall
| LT_PRTHS valueExpression RT_PRTHS # parentheticValueExpr
| LT_SQR_PRTHS subSearch RT_SQR_PRTHS # scalarSubqueryExpr
| ident ARROW expression # lambda
Expand Down Expand Up @@ -547,6 +548,11 @@ dataTypeFunctionCall
: CAST LT_PRTHS expression AS convertedDataType RT_PRTHS
;

// geoip function
geoipFunction
: GEOIP LT_PRTHS (datasource = functionArg COMMA)? ipAddress = functionArg (COMMA properties = stringLiteral)? RT_PRTHS
;

// boolean functions
booleanFunctionCall
: conditionFunctionBase LT_PRTHS functionArgs RT_PRTHS
Expand Down Expand Up @@ -580,6 +586,7 @@ evalFunctionName
| cryptographicFunctionName
| jsonFunctionName
| collectionFunctionName
| geoipFunctionName
| lambdaFunctionName
;

Expand Down Expand Up @@ -898,6 +905,10 @@ lambdaFunctionName
| REDUCE
;

geoipFunctionName
: GEOIP
;

positionFunctionName
: POSITION
;
Expand Down

0 comments on commit 06f1420

Please sign in to comment.