cloud-fan commented on code in PR #56892:
URL: https://github.com/apache/spark/pull/56892#discussion_r3497628086


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/literals.scala:
##########
@@ -592,13 +592,16 @@ case class Literal (value: Any, dataType: DataType) 
extends LeafExpression {
   override def sql: String = (value, dataType) match {
     case (_, NullType | _: ArrayType | _: MapType | _: StructType) if value == 
null => "NULL"
     case _ if value == null => s"CAST(NULL AS ${dataType.sql})"
-    case (v: UTF8String, StringType) =>
-      // Escapes all backslashes and single quotes.
-      "'" + v.toString.replace("\\", "\\\\").replace("'", "\\'") + "'"
     case (v: UTF8String, st: StringType) =>

Review Comment:
   Good call — added a direct `LiteralExpressionSuite` test (`SPARK-57777: 
render explicit collation in string literal SQL`) pinning the three cases: 
default singleton -> `'x'`, explicit `StringType("UTF8_BINARY")` -> `'x' 
collate UTF8_BINARY`, and `UTF8_LCASE` unchanged. Thanks for the review!
   



-- 
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]

Reply via email to