Skip to content

Commit 7da1370

Browse files
committed
docs: say that a literal day interval on a date stays native and only an interval column falls back
Spark rewrites a date plus or minus a DAY-precision interval to `date_add` over `ExtractANSIIntervalDays`. With a literal interval that folds to a plain `date_add`, which is native; only a non-foldable interval column reaches `ExtractANSIIntervalDays`, which has no serde, and falls back.
1 parent 02cc7bd commit 7da1370

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎docs/source/user-guide/latest/expressions.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@ The type-name conversion functions (`bigint`, `binary`, `boolean`, `date`, `deci
415415
| --- | --- | --- | --- |
416416
| `%` | ✅ | Native | |
417417
| `*` | ✅ | Native | DayTime interval multiplication routes through the JVM codegen dispatcher; YearMonth and Calendar interval multiplication fall back |
418-
| `+` | ✅ | Native | Adding a calendar, year-month or day-time interval to a date or timestamp routes through the JVM codegen dispatcher. `date + <day-time interval with DAY precision>` is rewritten by Spark to `DateAdd` over `ExtractANSIIntervalDays`, which has no serde yet and falls back to Spark |
419-
| `-` | ✅ | Native | `date - date`, `timestamp - timestamp` and subtracting an interval from a date or timestamp route through the JVM codegen dispatcher; `timestamp - timestamp` falls back to Spark in legacy interval mode (`spark.sql.legacy.interval.enabled=true`) because its calendar-interval result can exceed what the dispatcher output can carry. `date - <day-time interval with DAY precision>` is rewritten by Spark to `DateAdd` over `ExtractANSIIntervalDays`, which has no serde yet and falls back to Spark |
418+
| `+` | ✅ | Native | Adding a calendar, year-month or day-time interval to a date or timestamp routes through the JVM codegen dispatcher. `date + INTERVAL '<n>' DAY` is rewritten by Spark to `date_add` and stays native; a DAY-precision interval column added to a date is rewritten to `DateAdd` over `ExtractANSIIntervalDays`, which has no serde, so that projection falls back to Spark |
419+
| `-` | ✅ | Native | `date - date`, `timestamp - timestamp` and subtracting an interval from a date or timestamp route through the JVM codegen dispatcher; `timestamp - timestamp` falls back to Spark in legacy interval mode (`spark.sql.legacy.interval.enabled=true`) because its calendar-interval result can exceed what the dispatcher output can carry. `date - INTERVAL '<n>' DAY` is rewritten by Spark to `date_add` and stays native; a DAY-precision interval column subtracted from a date is rewritten to `DateAdd` over `ExtractANSIIntervalDays`, which has no serde, so that projection falls back to Spark |
420420
| `/` | ✅ | Native | |
421421
| `abs` | ✅ | Hybrid | Interval types route through the JVM codegen dispatcher; numeric types run natively |
422422
| `acos` | ✅ | Native | |

0 commit comments

Comments
 (0)