-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
I got an internal error when running a that unnests a struct and tries to add an alais
> select unnest(unnest(column1)) as "a" from t;
Internal error: Assertion failed: struct_allowed: unnest on struct can only be applied at the root level of select expression.
This issue was likely caused by a bug in DataFusion's code. Please help us to resolve this by filing a bug report in our issue tracker: https://github.com/apache/datafusion/issuesTo Reproduce
> create or replace table t as values ({foo: 1, bar:2});
0 row(s) fetched.
Elapsed 0.007 seconds.Unnesting works great
> select unnest(column1) from t;
+-------------------------------------+-------------------------------------+
| __unnest_placeholder(t.column1).foo | __unnest_placeholder(t.column1).bar |
+-------------------------------------+-------------------------------------+
| 1 | 2 |
+-------------------------------------+-------------------------------------+
1 row(s) fetched.
Elapsed 0.008 seconds.Unnesting with an alias results in an internal error
> select unnest(column1) as "a" from t;
Internal error: Assertion failed: struct_allowed: unnest on struct can only be applied at the root level of select expression.
This issue was likely caused by a bug in DataFusion's code. Please help us to resolve this by filing a bug report in our issue tracker: https://github.com/apache/datafusion/issuesExpected behavior
There should not be an internal error. Testing with duckdb seems to show the alias is ignored
andrewlamb@Andrews-MacBook-Pro-3:~/Software/datafusion2$ duckdb
DuckDB v1.4.3 (Andium) d1dc88f950
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.D create or replace table t as values ({foo: 1, bar:2});
D select unnest(col0) from t;
┌───────┬───────┐
│ foo │ bar │
│ int32 │ int32 │
├───────┼───────┤
│ 1 │ 2 │
└───────┴───────┘
D select unnest(col0) as "a" from t;
┌───────┬───────┐
│ foo │ bar │
│ int32 │ int32 │
├───────┼───────┤
│ 1 │ 2 │
└───────┴───────┘
### Additional context
_No response_Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working