-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Not sure if this is a bug or expected behaviour. make_array works with simple structs where the keys match
The following query works
> SELECT make_array(named_struct('1', 'a'), named_struct('1', 'b'));
+---------------------------------------------------------------------------------+
| make_array(named_struct(Utf8("1"),Utf8("a")),named_struct(Utf8("1"),Utf8("b"))) |
+---------------------------------------------------------------------------------+
| [{1: a}, {1: b}] |
+---------------------------------------------------------------------------------+
1 row(s) fetched.
Elapsed 0.013 seconds.
but fails when the struct's keys mismatch
To Reproduce
> SELECT make_array(named_struct('1', 'a'), named_struct('2', 'b'));
Error during planning: Execution error: Function 'make_array' user-defined coercion failed with "Error during planning: Failed to unify argument types of make_array: [Struct(\"1\": Utf8), Struct(\"2\": Utf8)]" No function matches the given name and argument types 'make_array(Struct("1": Utf8), Struct("2": Utf8))'. You might need to add explicit type casts.
Candidate functions:
make_array(UserDefined)
Expected behavior
Databricks for instance in this case assigns it's own column names col1, col2 for the struct fields. Should something like this be done? Or is it up to the user to add explicit casts
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working