LuciferYang opened a new pull request, #13714:
URL: https://github.com/apache/gluten/pull/13714

   ## What changes are proposed in this pull request?
   
   `PushDownInputFileExpression` gave wrong results for `input_file_name()` 
used through a projection over an offloaded scan (see the issue for the 
queries):
   
   - PreOffload now rewrites a Project or Filter only when it calls an input 
file function. A reference to a column that a lower projection named 
`input_file_name` also matched before: the rule wrapped an empty projection 
over the scan, and the function ended up evaluated above the native scan, where 
it returns an empty string.
   - PostOffload folds a projection into a file or Hive scan only when it is 
the one PreOffload added, so a projection that stays on Spark and computes 
other columns is kept.
   - For a DSv2 scan, PostOffload drops the inner projection only when it 
passes columns through, so a rename such as `input_file_name() AS f` is kept.
   
   The first case reproduces on v1.8.0-rc1 with default settings, so this 
should block 1.8.0.
   
   Fixes #13713.
   
   ## How was this patch tested?
   
   Added two tests to `FallbackSuite`. One runs `input_file_name()` next to a 
Scala UDF and with project offload off, and checks the results and that the 
scan stays native. The other uses `input_file_name()` through a column of an 
earlier projection, in a Project and a Filter, with DSv1 and DSv2 and project 
offload on and off. Both fail without the fix.
   
   ## Was this patch authored or co-authored using generative AI tooling?
   
   Yes. Generated-by: Claude Opus.
   


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