shrirangmhalgi opened a new pull request, #56085: URL: https://github.com/apache/spark/pull/56085
### What changes were proposed in this pull request? Handle `AlwaysTrue` and `AlwaysFalse` predicates in `V2ExpressionSQLBuilder.build()` by producing `"1 = 1"` and `"1 = 0"` respectively. `AlwaysTrue`/`AlwaysFalse` implement `Literal<Boolean>`, so they previously matched the `Literal` branch and produced bare `"TRUE"`/`"FALSE"` strings via `visitLiteral()`. Some databases (Oracle, DB2) do not support these as boolean expressions in WHERE clauses. ### Why are the changes needed? When AQE simplifies predicates to `AlwaysTrue`/`AlwaysFalse` and they are pushed down to JDBC, the generated SQL contains bare `TRUE`/`FALSE` which fails on databases that don't support boolean literals. This is a fresh, simplified approach per `cloud-fan`'s review feedback on the original PR #52198 (auto-closed due to inactivity) — using `1=1`/`1=0` universally without a dialect-specific API. ### Does this PR introduce _any_ user-facing change? Yes. JDBC pushed filter SQL now uses `1 = 1`/`1 = 0` instead of `TRUE`/`FALSE` for AlwaysTrue/AlwaysFalse predicates. This fixes queries that previously failed on Oracle/DB2. ### How was this patch tested? - Added unit test in `V2PredicateSuite` - Updated golden string in `JDBCV2Suite` (data assertions unchanged) - Full JDBC test suite: 256/256 pass ### Was this patch authored or co-authored using generative AI tooling? Yes. -- 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]
