Github user maropu commented on the issue:
https://github.com/apache/spark/pull/21215
How about this?
```
scala> val df = Seq(Outer(Seq.empty[Inner]),
Outer(Seq.empty[Inner])).toDF("a")
df: org.apache.spark.sql.DataFrame = [a: array<struct<b:int,c:string>>]
scala> df.printSchema
root
|-- a: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- b: integer (nullable = false)
| | |-- c: string (nullable = true)
scala> df.show
+---+
| a|
+---+
| []|
| []|
+---+
scala> val df = Seq(1, 2, 3).toDF("a").withColumn("b",
typedLit(Seq.empty[Inner]))
df: org.apache.spark.sql.DataFrame = [a: int, b:
array<struct<b:int,c:string>>]
scala> df.printSchema
root
|-- a: integer (nullable = false)
|-- b: array (nullable = false)
| |-- element: struct (containsNull = true)
| | |-- b: integer (nullable = false)
| | |-- c: string (nullable = true)
scala> df.show
+---+---+
| a| b|
+---+---+
| 1| []|
| 2| []|
| 3| []|
+---+---+
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]