You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/07/30 07:27:10 UTC

[GitHub] [spark] MaxGekk commented on a change in pull request #20176: [SPARK-22981][SQL] Fix incorrect results of Casting Struct to String

MaxGekk commented on a change in pull request #20176:
URL: https://github.com/apache/spark/pull/20176#discussion_r462546349



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
##########
@@ -259,6 +259,29 @@ case class Cast(child: Expression, dataType: DataType, timeZoneId: Option[String
         builder.append("]")
         builder.build()
       })
+    case StructType(fields) =>
+      buildCast[InternalRow](_, row => {
+        val builder = new UTF8StringBuilder
+        builder.append("[")

Review comment:
       Are there any reasons for using the same brackets `[]` for Struct, Map and Array?
   
   How about `[]` for arrays, `{}` for structs and `<>` for maps or somehow distinguish them. At least, it is not consistent with `toHiveString` which prints `{}` for structs and maps. 




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

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



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