gengliangwang opened a new pull request, #56219:
URL: https://github.com/apache/spark/pull/56219
### What changes were proposed in this pull request?
Add `DateTimeExpressionUtils.getNextDateExact(int startDate, UTF8String
dayOfWeek)` and route `NextDay`'s ANSI (`failOnError = true`) eval and codegen
paths through it.
In ANSI mode the previous codegen emitted `try { ... } catch
(SparkIllegalArgumentException e) { throw e; }` -- a no-op catch that simply
rethrew the same exception. The ANSI branch now emits a single
`getNextDateExact(...)` call with no try/catch (the helper lets the
`SparkIllegalArgumentException` from `DateTimeUtils.getDayOfWeekFromString`
propagate, which is exactly the ANSI behavior). The non-ANSI branch keeps the
inline `try/catch -> isNull` form (matching the already-merged `MakeDate` /
`MakeInterval` cleanups). The `dayOfWeek.foldable` constant-folding fast path
is unchanged. The eval path delegates to the same helper for consistency.
### Why are the changes needed?
Part of SPARK-56908 (umbrella). Dropping the dead try/catch wrapper (and the
two chained `DateTimeUtils` calls) in the ANSI path shrinks the generated Java
for `next_day`, helping with the JVM 64KB method / constant-pool limits, Janino
compile time, and JIT work.
### Does this PR introduce _any_ user-facing change?
No. The compiled behavior is identical; only the emitted Java source text
changes.
### How was this patch tested?
```
build/sbt "catalyst/testOnly *DateExpressionsSuite"
```
75/75 pass, including `next_day` (exercised both with and without
whole-stage codegen).
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]