dongjoon-hyun commented on a change in pull request #24505: [SPARK-27607][SQL] 
Improve Row.toString performance
URL: https://github.com/apache/spark/pull/24505#discussion_r280230619
 
 

 ##########
 File path: sql/core/src/test/scala/org/apache/spark/sql/RowSuite.scala
 ##########
 @@ -84,4 +84,17 @@ class RowSuite extends SparkFunSuite with SharedSQLContext {
     val r3 = Row("World")
     assert(r3.hashCode() != r1.hashCode())
   }
+
+  test("toString") {
+    val r1 = Row(2147483647, 21474.83647, (-5).toShort, "this is a string", 
true, null)
+    assert(r1.toString == "[2147483647,21474.83647,-5,this is a 
string,true,null]")
+    val r2 = Row(null, Int.MinValue, Double.NaN, Short.MaxValue, "", false)
+    assert(r2.toString == "[null,-2147483648,NaN,32767,,false]")
+    val tsString = "2019-05-01 17:30:12.0"
+    val r3 = Row(r1, Seq(1, 2, 3), Map(1 -> "a", 2 -> "b"), 
java.sql.Timestamp.valueOf(tsString))
+    assert(r3.toString == "[[2147483647,21474.83647,-5,this is a 
string,true,null]," +
+      s"List(1, 2, 3),Map(1 -> a, 2 -> b),$tsString]")
+    val empty = Row()
+    assert(empty.toString == "[]")
 
 Review comment:
   Looks good. @mgaido91 .
   Could you add more to be complete? For example, `ByteType`, `DecimalType`, 
`DateType`, `BinaryType`, `StructType`?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to