mihailom-db commented on code in PR #46437:
URL: https://github.com/apache/spark/pull/46437#discussion_r1595337990


##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/util/V2ExpressionSQLBuilder.java:
##########
@@ -65,7 +68,6 @@ protected String escapeSpecialCharsForLikePattern(String str) 
{
       switch (c) {
         case '_' -> builder.append("\\_");
         case '%' -> builder.append("\\%");
-        case '\'' -> builder.append("\\\'");

Review Comment:
   Yes I do. Unfortunately, \' is not a special character that should be 
escaped for like expression in this way for all JDBCDialects. First red flag is 
that H2 had to remove this change, wouldn't we expect that the special cases of 
JDBC have to only add characters? Second red flag was `JDBCV2Suite` that 
actually had a problem as it is not calling visitLiteral that is implemented in 
JDBCDialect, but the one from V2ExpressionSQLBuilder when it was displaying the 
pushdown result, which is why I would presume this escape was added in the 
first place. We need to escape \' only when we are using pure string literals, 
as these literals in sql come in format of 'value'. This addition to escape \' 
is already done in visitLiteral and should not be done here one more time. 



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to