This is the behavior for JVM Spark:
>>> spark.sql("""SELECT inline(array(struct(1), struct(2)))""").show()
+----+
|col1|
+----+
| 1|
| 2|
+----+
>>> spark.sql("""SELECT inline(array(struct(1, 'a'), struct(2, 'b')))""").show()
+----+----+
|col1|col2|
+----+----+
| 1| a|
| 2| b|
+----+----+
This is the behavior for Sail currently:
>>> spark.sql("""SELECT inline(array(struct(1), struct(2)))""").show()
+-----------------------------------+
|inline(array(struct(1), struct(2)))|
+-----------------------------------+
| 1|
| 2|
+-----------------------------------+
>>> spark.sql("""SELECT inline(array(struct(1, 'a'), struct(2, 'b')))""").show()
+----+----+
|col1|col2|
+----+----+
| 1| a|
| 2| b|
+----+----+
So the inner field name is not preserved when the struct has only one field. This should be fixed.
This is the behavior for JVM Spark:
This is the behavior for Sail currently:
So the inner field name is not preserved when the struct has only one field. This should be fixed.