ViktorBystrov72 opened a new pull request, #60659:
URL: https://github.com/apache/spark/pull/60659

   ### What changes were proposed in this pull request?
   
   Build the small `LocalRelation` used by recursive CTE execution from 
collected Catalyst rows. Use the same Dataset action wrapper for collection so 
the jobs remain associated with the query execution.
   
   ### Why are the changes needed?
   
   The materialization path converts a small result to external `Row`s and 
back. With the legacy Java datetime API, that round trip changes dates in the 
Gregorian calendar gap and can shift timestamps in a historical time zone 
overlap. This affects the anchor and the recursive terms. 
[SPARK-61943](https://issues.apache.org/jira/browse/SPARK-61943)
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Recursive CTEs preserve SQL date and timestamp values when an iteration 
is materialized as a local relation. The regression covers `DATE '1582-10-10'` 
and a timestamp in the 1883 Los Angeles offset overlap.
   
   ### How was this patch tested?
   
   The new test compares dates as strings and timestamps as epoch microseconds. 
It covers values produced by the anchor and values first produced in the 
recursive term. The baseline failed with local materialization enabled under 
both adaptive execution settings. Both controls with local materialization 
disabled passed.
   
   All 101 tests in the two CTE suites and both checks for `cte-recursion.sql` 
passed.
   
   ```text
   sql/testOnly *CTEInlineSuiteAE*
   sql/testOnly org.apache.spark.sql.SQLQueryTestSuite -- -z cte-recursion.sql
   sql/Compile/scalastyle
   sql/Test/scalastyle
   ```
   
   Apache RAT passed with the repository exclusions and the local worktree's 
`.git` metadata file excluded.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex (gpt-6.2-sol).
   


-- 
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]

Reply via email to