Skip to content

[SPARK-52232][SQL] Fix non-deterministic queries to produce different results at every step #50957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Pajaraja
Copy link
Contributor

What changes were proposed in this pull request?

Enable deterministic queries to work with rCTEs. Fix bug where non-deterministic queries produce same result every iteration.

Why are the changes needed?

Currently, recursive CTEs create a new plan for each iteration of the recursion, so the expressions that use randomness "roll-back" to their initial value, causing things like "rand()" to produce the same result every time.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

New tests in golden files.

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions bot added the SQL label May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant