cloud-fan commented on code in PR #51190:
URL: https://github.com/apache/spark/pull/51190#discussion_r2168131476
##########
sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4:
##########
@@ -1230,6 +1231,35 @@ primaryExpression
FROM position=valueExpression (FOR length=valueExpression)? RIGHT_PAREN
#overlay
;
+semiStructuredExtractionPath
+ : jsonPathFirstPart (jsonPathParts)*
+ ;
+
+jsonPathIdentifier
+ : identifier
+ | BACKQUOTED_IDENTIFIER
+ ;
+
+jsonPathBracketedIdentifier
+ : LEFT_BRACKET stringLit RIGHT_BRACKET
+ ;
+
+jsonPathFirstPart
+ : jsonPathIdentifier
+ | jsonPathBracketedIdentifier
+ | DOT
+ | LEFT_BRACKET INTEGER_VALUE RIGHT_BRACKET
+ | LEFT_BRACKET ASTERISK RIGHT_BRACKET
+ ;
+
+jsonPathParts
+ : DOT jsonPathIdentifier
+ | jsonPathBracketedIdentifier
+ | LEFT_BRACKET INTEGER_VALUE RIGHT_BRACKET
+ | LEFT_BRACKET ASTERISK RIGHT_BRACKET
+ | LEFT_BRACKET identifier RIGHT_BRACKET
Review Comment:
can we test these two syntaxes? `field['string']` and `field[*]`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]