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

   ### What changes were proposed in this pull request?
   
   Added the timezone to the CAST that happens in the replacement of the 
UNIFORM expression.
   
   ### Why are the changes needed?
   
   Since this Cast doesn't need any information about time zones, they are not 
explicitly needed. However, ResolveTimeZone in the analyzer does put the 
timezone into every cast created before analysis. This causes a problem between 
the fixed-point and single-pass analyzer, since reanalyzing queries produces 
different results (single-pass reanalyzes the plan and puts the timezone for 
the new Cast, while the fixed-point considers the Cast already resolved and 
doesn't do anything).
   
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Single pass analyzer is enabled in dual run mode in the cte-recursion golden 
file (and ctePrecedencePolicy isn't set to EXCEPTION), so the golden file is 
being ran on in the singe-pass analyzer. However, since recursive CTEs are 
still not in single pass, the new analyzer is only invoked in the recursion 
steps. Without this change, the query 
   
   ```
   WITH RECURSIVE randoms(val) AS (
       SELECT CAST(UNIFORM(1, 6, 82374) AS INT)
       UNION ALL
       SELECT CAST(UNIFORM(1, 6, 237685) AS INT)
       FROM randoms
   )
   SELECT val FROM randoms LIMIT 5;
   ```
   
   fails with plan_mismatch_error (while executing the anchor).
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   No.
   


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