databrickslabs / remorph

Cross-compiler and Data Reconciler into Databricks Lakehouse
Other
21 stars 13 forks source link

TSQL: Support generic FOR options #525

Closed jimidle closed 1 month ago

jimidle commented 1 month ago

Some TSQL option clauses use the keyword FOR, which is not allowed to be used as an identifier without escaping it using the standard syntax [FOR] as it would be seen as a table alias in a SELECT statement. Hence it must be catered for explicitly in the generic option syntax.

For example:

SELECT * FROM t FOR XML RAW
            OPTION (
                OPTIMIZE FOR UNKNOWN
            )

In the example, the first FOR would be seen as an alias for table t if it were allowed to be a keyword usable directly as an Identifier.

Here, we expand the ANTLR rule for parsing generically formed options, such that options containing FOR are correctly parsed as options.

github-actions[bot] commented 1 month ago

Coverage tests results

394 tests   355 :white_check_mark:  4s :stopwatch:   2 suites    2 :zzz:   2 files     37 :x:

For more details on these failures, see this check.

Results for commit 4826f49c.

:recycle: This comment has been updated with latest results.