AngersZhuuuu commented on pull request #29085:
URL: https://github.com/apache/spark/pull/29085#issuecomment-661597390


   @maropu ArrayType/MapType/StructType data format show as  below
   
   ```
   test("SPARK-32106: TRANSFORM support complex data types as input and ouput 
type (hive serde)") {
       assume(TestUtils.testCommandAvailable("/bin/bash"))
       withTempView("v") {
         val df = Seq(
           (1, "1", Array(0, 1, 2), Map("a" -> 1)),
           (2, "2", Array(3, 4, 5), Map("b" -> 2)))
           .toDF("a", "b", "c", "d")
             .select('a, 'b, 'c, 'd, struct('a, 'b).as("e"))
         df.createTempView("v")
   
         sql(
           """
             |SELECT TRANSFORM(c, d, e)
             |USING 'cat' as (c, d, e)
             |FROM v
           """.stripMargin).show()
   
         sql(
           """
             |SELECT TRANSFORM(c, d, e)
             |USING 'cat' as (c int, d string, e string)
             |FROM v
           """.stripMargin).show()
   
         sql(
           """
             |SELECT TRANSFORM(c, d, e)
             |USING 'cat' as (c array<int>, d map<string,int>, e 
struct<col1:int, col2:string>)
             |FROM v
           """.stripMargin).show()
       }
     }
   ```
   
   ```
   +-----+---+---+
   |    c|  d|  e|
   +-----+---+---+
   |012|a1|11|
   |345|b2|22|
   +-----+---+---+
   
   +----+---+---+
   |   c|  d|  e|
   +----+---+---+
   |null|a1|11|
   |null|b2|22|
   +----+---+---+
   
   +---------+--------+------+
   |        c|       d|     e|
   +---------+--------+------+
   |[0, 1, 2]|[a -> 1]|[1, 1]|
   |[3, 4, 5]|[b -> 2]|[2, 2]|
   +---------+--------+------+
   ```


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