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

   ### What changes were proposed in this pull request?
   
   Return `None` when a `NOT`, `AND`, or `OR` operand translates to a scalar 
expression instead of a V2 predicate. This leaves the expression for Spark to 
evaluate when predicate pushdown is unavailable.
   
   ### Why are the changes needed?
   
   A Boolean cast can translate to a scalar `V2Cast`. The existing assertion 
expects every translated child of `NOT`, `AND`, and `OR` to be a `V2Predicate`, 
so a nested cast can abort query planning instead of skipping pushdown.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Queries with a Boolean cast nested in a V2 filter expression can 
previously fail during planning with an assertion when ANSI mode is enabled. 
They now run with that expression evaluated by Spark. With ANSI mode disabled, 
the cast already skips V2 translation.
   
   ### How was this patch tested?
   
   Added a parameterized `DataSourceV2StrategySuite` test for ANSI-on and 
ANSI-off Boolean casts inside `NOT`, `AND`, `OR`, and a nested `CASE WHEN` 
filter.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex (GPT-6).
   


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