srielau opened a new pull request, #59716: URL: https://github.com/apache/spark/pull/59716
### What changes were proposed in this pull request? When `spark.sql.readSideCharPadding` is true (the default), CHAR columns on a scan are wrapped in `StaticInvoke(CharVarcharCodegenUtils.readSidePadding, col, n)` rather than `StringRPad`. DSv2 filter translation did not understand that invoke, so JDBC CHAR comparisons such as `CHAR_COL = 'Y'` were evaluated in Spark after a full remote read. `IS NOT NULL` still pushed. This maps the read-side padding invoke (and `charTypeReadSideCheck` under standard semantics) to the same V2 `RPAD` expression already used for `StringRPad`, and adds `RPAD` to `OracleDialect` so Oracle JDBC can compile it. The pushed predicate is `RPAD(col, n, ' ') = lit`, matching Spark string equality on the padded value. Bare `col = lit` is not used, because remote CHAR comparison is not the same when the literal is shorter than `n`. ### Why are the changes needed? JDBC/DSv2 CHAR filters were silently not pushed under the default CHAR-padding config, which can turn a remote predicate into a full table scan. Predicate-side `StringRPad` was already pushable after SPARK-50692; the default read-side path was not. ### Does this PR introduce _any_ user-facing change? Yes. JDBC/DSv2 queries that filter CHAR columns can now push those predicates to the remote system when the dialect supports `RPAD`, including Oracle. Results are unchanged; less data is transferred. ### How was this patch tested? - `DataSourceV2StrategySuite`: `readSidePadding` / `charTypeReadSideCheck` translate to V2 `RPAD`; `varcharTypeReadSideCheck` does not - `JDBCSuite`: Oracle dialect compiles `RPAD(...) = 'Y'` - `JDBCV2Suite`: H2 CHAR(1) equality is fully pushed as `(RPAD(flag, 1, ' ')) = 'Y'` ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Cursor Grok 4.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]
