beliefer commented on code in PR #43801:
URL: https://github.com/apache/spark/pull/43801#discussion_r1400121955
##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/util/V2ExpressionSQLBuilder.java:
##########
@@ -48,6 +48,29 @@
*/
public class V2ExpressionSQLBuilder {
+ protected String escapeSpecialChar(String str) {
+ StringBuilder builder = new StringBuilder();
+
+ for (char c : str.toCharArray()) {
+ switch (c) {
+ case '_':
+ builder.append("\\_");
+ break;
+ case '%':
+ builder.append("\\%");
+ break;
+ case '\'':
+ builder.append("\'");
Review Comment:
H2 doesn't it.
```
org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement
"SELECT ""EMAIL"" FROM ""test"".""address"" WHERE (""EMAIL"" IS NOT NULL) AND
(""EMAIL"" LIKE 'abc\\_\\'[*]\\'\\%%') "; SQL statement:
SELECT "EMAIL" FROM "test"."address" WHERE ("EMAIL" IS NOT NULL) AND
("EMAIL" LIKE 'abc\_\'\'\%%') [42000-220]
```
--
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]