Skip to content

Commit

Permalink
Modified Geospatial TSQL Syntax Support (#2313) (#2324)
Browse files Browse the repository at this point in the history
* Modified Geospatial TSQL Syntax Support (#2313)

This commit contains a few changes from #2271
Moved Duplicated Code to common helper functions for Exit functions handling Geospatial functional call in both TSQLBuilder and TSQLCommonMutator.
 To handle local id's we are now quoting them in the geospatial handling itself rather than modifying their start positions, so as to remove the possibility of multiple rewrites within a single context.

Signed-off-by: Anikait Agrawal [[email protected]](mailto:[email protected])

* Retrigger Tests

---------

Signed-off-by: Anikait Agrawal [[email protected]](mailto:[email protected])
Co-authored-by: Anikait Agrawal <[email protected]>
  • Loading branch information
Anikait143 and Anikait Agrawal authored Jan 31, 2024
1 parent 65debe3 commit c15a1cb
Show file tree
Hide file tree
Showing 2 changed files with 195 additions and 334 deletions.
12 changes: 8 additions & 4 deletions contrib/babelfishpg_tsql/antlr/TSqlParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -3436,10 +3436,7 @@ constant_LOCAL_ID
// https://docs.microsoft.com/en-us/sql/t-sql/language-elements/expressions-transact-sql
// Operator precendence: https://docs.microsoft.com/en-us/sql/t-sql/language-elements/operator-precedence-transact-sql
expression
: local_id (DOT calls+=method_call)* #local_id_expr
| subquery (DOT calls+=method_call)* #subquery_expr
| LR_BRACKET expression RR_BRACKET (DOT calls+=method_call)* #bracket_expr
| function_call (DOT calls+=method_call)* #func_call_expr
: clr_udt_func_call #clr_udt_expr
| expression collation #collate_expr
| expression AT_KEYWORD TIME ZONE expression #time_zone_expr
| op=(MINUS | PLUS | BIT_NOT) expression #unary_op_expr
Expand All @@ -3456,6 +3453,13 @@ expression
| DOLLAR_ACTION #dollar_action_expr
;

clr_udt_func_call
: local_id (DOT calls+=method_call)*
| subquery (DOT calls+=method_call)*
| LR_BRACKET expression RR_BRACKET (DOT calls+=method_call)*
| function_call (DOT calls+=method_call)*
;

method_call
: xml_methods
| hierarchyid_methods
Expand Down
Loading

0 comments on commit c15a1cb

Please sign in to comment.