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

   ### What changes were proposed in this pull request?
   
   `CleanupDynamicPruningFilters` now also removes a DPP filter from a scan 
when the pruning key only references columns the scan cannot prune on: not 
partition columns for `HadoopFsRelation` / `HiveTableRelation`, and not 
`runtimeFilterAttrs` for a DSv2 scan.
   
   ### Why are the changes needed?
   
   Since SPARK-39217 the DPP filter above a Union is pushed into every branch. 
On a branch whose table is not partitioned on the key it stays in a 
`FilterExec`. `InSubqueryExec` does not broadcast DPP results, so without 
whole-stage codegen the interpreted filter fails in a task:
   
   ```
   IllegalArgumentException: requirement failed: input[0, int, true] IN 
dynamicpruning#64 has not finished
   ```
   
   Repro in SPARK-61740. On 3.5 to 4.2 it also fails with default settings when 
the branch's key is a higher-order function.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, the query no longer fails. A DPP filter on a non-partitioned branch 
could not prune anything, so no plan loses pruning.
   
   ### How was this patch tested?
   
   New test in `DynamicPartitionPruningSuite` (Union of a partitioned and a 
non-partitioned table, codegen off). It fails without the change. Rebased on 
current master: the rule changed in SPARK-30628, so the new condition is added 
next to the existing equality and pushed-filter checks, keeping both.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude Opus 5.5)
   


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