SubhamSinghal opened a new issue, #21596:
URL: https://github.com/apache/datafusion/issues/21596

   ### Is your feature request related to a problem or challenge?
   
   [Discussion 
thread](https://github.com/apache/datafusion/pull/21479#discussion_r3068891661)
   
   The `WindowTopN` physical optimizer rule currently skips `FilterExec` nodes 
that have an embedded projection (`filter.projection().is_some()`). This 
happens when `ProjectionPushdown` runs before `WindowTopN` and embeds a 
projection into the `FilterExec`.
   
     ```rust
     // Don't handle filters with projections
     if filter.projection().is_some() {
         return None;
     } 
   ```
   
   ### Describe the solution you'd like
   
    Extend WindowTopN to handle FilterExec with embedded projections. This 
would require:
   
     1. Extracting the projection mapping from FilterExec
     2. Resolving the window column index through the projection (mapping 
projected column indices back to the original schema)
     3. Carrying the projection forward into the replacement plan (either 
re-wrapping PartitionedTopKExec with a ProjectionExec, or embedding the 
projection)
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Additional context
   
   _No response_


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