Skip to content

[SPARK-56921][SQL] Fix CTE ID normalization for nested CTEs#55985

Open
puneetdixit200 wants to merge 1 commit into
apache:masterfrom
puneetdixit200:fix-spark-56921-normalize-nested-cte
Open

[SPARK-56921][SQL] Fix CTE ID normalization for nested CTEs#55985
puneetdixit200 wants to merge 1 commit into
apache:masterfrom
puneetdixit200:fix-spark-56921-normalize-nested-cte

Conversation

@puneetdixit200
Copy link
Copy Markdown

What changes were proposed in this pull request?

This updates NormalizeCTEIds so normalization for the current WithCTE scope does not descend into nested WithCTE nodes that will be normalized by the normal top-down traversal. This prevents nested CTE refs from being remapped twice when plans contain nested WithCTE nodes under a union.

A regression test covers the reported temp-view + nested CTE + union pattern and forces queryExecution.normalized before checking the result.

How was this patch tested?

  • git diff --check
  • JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH" ./build/sbt "sql/testOnly org.apache.spark.sql.CTEInlineSuiteAEOff -- -z SPARK-56921"
  • JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH" ./build/sbt "sql/testOnly org.apache.spark.sql.CTEInlineSuiteAEOn -- -z SPARK-56921"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant