Skip to content

Conversation

@Pajaraja
Copy link
Contributor

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.

@github-actions github-actions bot added the SQL label Dec 25, 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