jiwen624 opened a new pull request, #56558: URL: https://github.com/apache/spark/pull/56558
### What changes were proposed in this pull request? MySQL treats `\` as an escape character inside string literals. `MySQLDialect.escapeSql` now doubles backslashes (on top of the base single-quote doubling), so every literal pushed through `compileValue` (`=`, `<>`, `<`, `<=`, `>`, `>=`, `IN`, ...) is parsed correctly. To avoid double-escaping, `JDBCSQLBuilder.build` now renders `STARTS_WITH`/`ENDS_WITH`/`CONTAINS` from the raw literal value through the same `escapeSql`; the redundant `escapeStringLiteralForLikePattern` override is removed. Generated LIKE SQL is unchanged for every dialect. ### Why are the changes needed? `WHERE c = 'a\b'` was pushed to MySQL as `` `c` = 'a\b' ``, which MySQL parses as `` `c` = 'a<backspace>' ``, silently dropping the matching row (wrong results). This is the comparison/`IN` sibling of SPARK-57332, which fixed only the LIKE family. Standard-SQL dialects are unaffected. ### Does this PR introduce _any_ user-facing change? Yes - fixing JDBC pushdown for string literals with escape backslash ### How was this patch tested? Added UT cases ### Was this patch authored or co-authored using generative AI tooling? Yes. Claude Code -- 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]
