MaxGekk opened a new pull request, #56863: URL: https://github.com/apache/spark/pull/56863
### What changes were proposed in this pull request? Remove two midnight-sensitive golden cases from `cast.sql` (and the imported `nonansi/cast.sql`): ```sql SELECT CAST(x AS DATE) = current_date() FROM VALUES (CAST(TIME'12:34:56' AS TIMESTAMP_NTZ)) t(x); SELECT CAST(x AS DATE) = current_date() FROM VALUES (CAST(TIME'12:34:56' AS TIMESTAMP_LTZ)) t(x); ``` added by SPARK-57618 (NTZ) and SPARK-57660 (LTZ). The comments are corrected and the golden files regenerated. The existing deterministic round-trip rows (`CAST(x AS TIME(6))` / `CAST(x AS TIME(9))`) are kept, so the inline-table early-evaluation path stays covered. ### Why are the changes needed? These rows assert `true` but can flip to `false` across a midnight boundary. An inline-table row that is foldable and carries no `CURRENT_LIKE` pattern is early-evaluated at analysis time by `ResolveInlineTables` (`EvaluateUnresolvedInlineTable.earlyEvalIfPossible` -> `EvalInlineTables.eval`), which runs the interpreted cast's `currentDate(zoneId)` = `LocalDate.now(zoneId)`. The sibling `current_date()` keeps its `CURRENT_LIKE` bit, survives to the optimizer, and is stabilized separately by `ComputeCurrentTime` from a different clock read. If analysis finishes just before midnight and optimization starts just after, `x`'s date is yesterday while `current_date()` is today, so the row returns `false` and the golden fails. The inline-table cast never reaches `ComputeCurrentTime` (the analyzer consumes it first), so it cannot be stabilized; comparing it against `current_date()` is inherently non-deterministic. The non-inline-table `CAST(CAST(TIME ... AS TIMESTAMP_NTZ) AS DATE) = current_date()` cases are unaffected — those go through `ComputeCurrentTime` and share the same date literal. ### Does this PR introduce _any_ user-facing change? No. Test-only change. ### How was this patch tested? Regenerated `cast.sql` / `nonansi/cast.sql` golden files and ran `SQLQueryTestSuite -- -z cast.sql` (6 tests pass) in normal mode. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Cursor (Claude 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]
