ViktorBystrov72 opened a new pull request, #60604: URL: https://github.com/apache/spark/pull/60604
### What changes were proposed in this pull request? Update `DeduplicateRelations` to remap `DynamicPruningSubquery.buildKeys` when it renews the subquery's output attributes. Preserve the outer pruning key and the existing broadcast value projection metadata. Add analyzer coverage for multiple build keys, an expression key, and optional broadcast projection metadata. Add recursive CTE regressions covering DPP in the recursive step and anchor, local and RDD-backed intermediate results, V1 and three V2 filtering APIs, and AQE on/off. ### Why are the changes needed? [SPARK-61255](https://issues.apache.org/jira/browse/SPARK-61255): a recursive CTE joining a partitioned table fails with `INTERNAL_ERROR: Found the unresolved operator: 'Filter ... dynamicpruning...` when DPP is enabled. The recursive executor substitutes the previous iteration's result and analyzes the plan again. Deduplication renews the DPP build plan's attributes but leaves the build keys referring to its old expression IDs. The subquery then becomes unresolved. Renewing those references together fixes the failure while retaining DPP. ### Does this PR introduce _any_ user-facing change? Yes. Affected recursive CTEs execute successfully with DPP enabled instead of raising an internal error. The Jira reproducer returns its expected nine rows without disabling partition pruning. ### How was this patch tested? Before the fix, both new analyzer cases and 18 SQL regression cases failed with the unresolved DPP operator; 22 SQL control cases passed. After the fix, all 42 focused cases passed. The full scoped suites passed: 131 Catalyst tests and 199 SQL tests (3 ignored), with 30 additional SQL regression cases passing in the remaining six DPP configurations. ScalaStyle passed for Catalyst production/tests and SQL tests. Scoped validation: ```text catalyst/testOnly org.apache.spark.sql.catalyst.analysis.AnalysisSuite *DynamicPruningSubquerySuite *ResolveSubquerySuite sql/testOnly *DynamicPartitionPruning*SuiteAE* -- -z SPARK-61255 sql/testOnly org.apache.spark.sql.DynamicPartitionPruningV1SuiteAEOff org.apache.spark.sql.DynamicPartitionPruningV2CatalystFilterSuiteAEOn *CTEInlineSuite* catalyst/Compile/scalastyle catalyst/Test/scalastyle sql/Test/scalastyle ``` Apache RAT was also run with the repository exclusion file plus `.git` (the local worktree metadata file). No source files were additionally excluded. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: OpenAI Codex (gpt-6.1-sol; exact tool build unavailable). -- 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]
