Commit ba0f026
committed
fix(databricks,tsql): consolidate Databricks date_add to Spark routing
Databricks aliases `date_add` and `dateadd`; arity selects the semantic.
The 2-arg form returns DATE; the 3-arg form returns the operand's type.
On main, Databricks parser collapsed both forms to exp.DateAdd, blocking
type disambiguation. Spark already routes 2-arg to exp.TsOrDsAdd and
3-arg to exp.TimestampAdd.
Drop the Databricks-specific DATEADD/DATE_ADD parser overrides so the
inherited Spark routing applies. Add an exp.TimestampAdd entry to the
T-SQL generator so the 3-arg form transpiles to DATEADD instead of
falling back to TIMESTAMP_ADD. Annotate exp.TsOrDsAdd as DATE in Spark's
typing module so 2-arg date_add annotation matches the documented Spark
contract (was UNKNOWN).
Updated assertions in tests/dialects/test_databricks.py reflect the
consolidated routing: Databricks 3-arg now round-trips as DATE_ADD
(matching test_spark.py and test_bigquery.py expectations) and 2-arg
T-SQL output now matches Spark's existing CAST behavior.1 parent 72f2afb commit ba0f026
3 files changed
Lines changed: 8 additions & 68 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| 237 | + | |
237 | 238 | | |
238 | 239 | | |
239 | 240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | 385 | | |
390 | 386 | | |
391 | 387 | | |
392 | | - | |
| 388 | + | |
393 | 389 | | |
394 | 390 | | |
395 | 391 | | |
396 | 392 | | |
397 | 393 | | |
398 | 394 | | |
399 | 395 | | |
400 | | - | |
401 | | - | |
402 | 396 | | |
403 | 397 | | |
404 | 398 | | |
405 | 399 | | |
406 | 400 | | |
407 | 401 | | |
408 | 402 | | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
418 | 408 | | |
419 | | - | |
420 | | - | |
421 | | - | |
| 409 | + | |
422 | 410 | | |
423 | 411 | | |
424 | 412 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1418 | 1418 | | |
1419 | 1419 | | |
1420 | 1420 | | |
1421 | | - | |
1422 | | - | |
1423 | | - | |
1424 | | - | |
1425 | | - | |
1426 | | - | |
1427 | | - | |
1428 | | - | |
1429 | | - | |
1430 | | - | |
1431 | | - | |
1432 | | - | |
1433 | | - | |
1434 | | - | |
1435 | | - | |
1436 | | - | |
1437 | | - | |
1438 | | - | |
1439 | | - | |
1440 | | - | |
1441 | | - | |
1442 | | - | |
1443 | | - | |
1444 | | - | |
1445 | | - | |
1446 | | - | |
1447 | | - | |
1448 | | - | |
1449 | | - | |
1450 | | - | |
1451 | | - | |
1452 | | - | |
1453 | | - | |
1454 | | - | |
1455 | | - | |
1456 | | - | |
1457 | | - | |
1458 | | - | |
1459 | | - | |
1460 | | - | |
1461 | | - | |
1462 | | - | |
1463 | | - | |
1464 | | - | |
1465 | | - | |
1466 | | - | |
1467 | | - | |
1468 | | - | |
1469 | | - | |
1470 | 1421 | | |
1471 | 1422 | | |
1472 | 1423 | | |
| |||
0 commit comments