-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
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
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working