zhztheplayer commented on PR #6458:
URL: 
https://github.com/apache/incubator-gluten/pull/6458#issuecomment-2264423961

   Hi @jinchengchenghh , I have been thinking if the code can be simplified to 
ease maintenance. 
   
   Would you please have a check about the following example code to pretty 
print a row iterator with much less code than `ToStringUtil`:
   
   ```scala
   test("UnsafeRow to string 2") {
     val util = ToStringUtil(Option.apply(SQLConf.get.sessionLocalTimeZone))
     val row1 =
       InternalRow.apply(UTF8String.fromString("hello"), 
UTF8String.fromString("world"), 123)
     val rowWithNull = InternalRow.apply(null, null, 4)
     val row2 = UnsafeProjection
       .create(Array[DataType](StringType, StringType, IntegerType))
       .apply(rowWithNull)
     val it = List(row1, row2, row1, row1, row2).toIterator
     val struct = new StructType().add("a", StringType).add("b", 
StringType).add("c", IntegerType)
   
     val encoder = RowEncoder(struct).resolveAndBind()
     val deserializer = encoder.createDeserializer()
     it.map(deserializer).foreach(r => println(r.mkString("|")))
   }
   ```


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