databrickslabs / remorph

Cross-compiler and Data Reconciler into Databricks Lakehouse
Other
37 stars 23 forks source link

Implement TSQL specific function call mapper #765

Closed jimidle closed 2 months ago

jimidle commented 2 months ago

Here, we implement the function call mapper (Rule) that allows us to make complex transformations from TSQL specific functions into Databricks compatible constructs. Transformations are sometimes argument reordering, and sometimes replacement with a different expression.

In this PR we use the transformation of TSQL DATEADD to Databricks SQL DATE_ADD, ADD_MONTHS and xxx + INTERVAL n {days|months|etc}

For example the TSQL:

SELECT DATEADD(hh, 7, col1) AS add_hours_col1 FROM tabl;

Translates to:

SELECT col1 + INTERVAL 7 HOUR AS add_hours_col1 FROM tabl;
github-actions[bot] commented 2 months ago

Coverage tests results

401 tests  ±0   135 :white_check_mark: +26   4s :stopwatch: ±0s   2 suites ±0     0 :zzz: ± 0    2 files   ±0   266 :x:  - 26 

For more details on these failures, see this check.

Results for commit 1cc34125. ± Comparison against base commit 94a3690f.

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