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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ToPrettyString.scala:
##########
@@ -51,7 +52,13 @@ case class ToPrettyString(child: Expression, timeZoneId: 
Option[String] = None)
 
   override protected val binaryFormatter: BinaryFormatter = 
ToStringBase.getBinaryFormatter
 
-  private[this] lazy val castFunc: Any => UTF8String = 
castToString(child.dataType)
+  private[this] lazy val castFunc: Any => UTF8String = child.dataType match {
+    case CharType(length) if SQLConf.get.preserveCharVarcharTypeInfo =>
+      castToChar(child.dataType, length)

Review Comment:
   This is wrong. `ToPrettyString` always cast the child data type to plain 
string type. So the cast target is always plain string.



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