goldmedal opened a new issue, #13659:
URL: https://github.com/apache/datafusion/issues/13659
### Describe the bug
There is a common usage of SQL to operate the nested data that is allowed by
Postgres and DuckDB but DataFusion can't execute.
## Postgres
```
postgres=# create table unnest_test (c1 int[]);
CREATE TABLE
postgres=# insert into unnest_test values (ARRAY [1,2,3]);
INSERT 0 1
postgres=# select * from unnest_test u, unnest(u.c1);
c1 | unnest
---------+--------
{1,2,3} | 1
{1,2,3} | 2
{1,2,3} | 3
(3 rows)
```
## DuckDB
```
D create table t1(c1 int[]);
D insert into t1 values ([1,2,3]);
D select * from t1, unnest(t1.c1);
┌───────────┬───────┐
│ c1 │ c1 │
│ int32[] │ int32 │
├───────────┼───────┤
│ [1, 2, 3] │ 1 │
│ [1, 2, 3] │ 2 │
│ [1, 2, 3] │ 3 │
└───────────┴───────┘
```
### To Reproduce
It can be reproduced by the following SQL (I just added them in the
sqlogicitests `unnest.slt` and ran the test)
```
statement ok
create table t1(c1 array<int>);
statement ok
insert into t1 values ([1,2,3]);
query ?I
select * from t1, unnest(t1.c1)
----
[1, 2, 3] 1
[1, 2, 3] 2
[1, 2, 3] 3
```
Then, it will throw the error:
```
Running "unnest.slt"
External error: query failed: DataFusion error: Schema error: No field named
t1.c1.
[SQL] select * from t1, unnest(t1.c1)
```
### Expected behavior
The test mentioned above should pass.
### Additional context
_No response_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]