Skip to content

Column name for inline explode #1909

@linhr

Description

@linhr

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions