linhongliu-db opened a new pull request, #59812: URL: https://github.com/apache/spark/pull/59812
### What changes were proposed in this pull request? Quote every StringType literal in the connector SQL renderer, including non-default collations and CHAR/VARCHAR string types. Add a comment explaining why the type pattern is required. ### Why are the changes needed? The StringType singleton pattern only matches the default collation. A UTF8_LCASE literal containing `it's` currently renders as `it's` without surrounding SQL quotes, instead of `'it''s'`. Pattern predicates strip the assumed surrounding quotes, so an empty collated literal can throw and other literals can lose characters. ### Does this PR introduce _any_ user-facing change? Yes, a bug fix. Collated string literals receive the same quoting and escaping as ordinary string literals. NULL continues to render as NULL. ### How was this patch tested? Added regression coverage for collated and constrained string types, NULL, empty and quoted strings, and pattern-predicate descriptions. Four new literal cases fail on unchanged Apache code. On JDK 17, all 10 LiteralValueSuite tests, 21 V2PredicateSuite tests, and the JDBC filter-compilation test passed. Catalyst main/test and SQL test Scalastyle checks and git diff --check passed. ```bash build/sbt 'catalyst/testOnly org.apache.spark.sql.connector.expressions.LiteralValueSuite' build/sbt 'sql/testOnly org.apache.spark.sql.execution.datasources.v2.V2PredicateSuite' build/sbt 'sql/testOnly org.apache.spark.sql.jdbc.JDBCSuite -- -z "compile filters"' ``` ### 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]
