You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add the ability to create tables with deeply nested schemas in SQL #11746
Is your feature request related to a problem or challenge?
At the moment, we cannot create tables with deeply nested columns, for example a column that has a map of string to list of structs etc.
We should have the ability to create deeply nested schemas in SQL
Describe the solution you'd like
DuckDB has in its SQL DML dialect some markers / functions that allow this:
CREATE OR REPLACE TABLE test1 (
struct1 STRUCT(
name VARCHAR,
bools BOOLEAN,
uint32 UINTEGER,
-- a list of strings
tags VARCHAR[]
),
-- a list of structs
list_struct STRUCT(
bools BOOLEAN,
uint32 UINTEGER,
-- a list of ints
ints32 INTEGER[]
)[],
struct_list STRUCT(
bools BOOLEAN,
uint32 UINTEGER,
-- a list of structs
products STRUCT(
qty INT4,
name VARCHAR
)[]
),
-- map of string to map
map_map_struct MAP(
VARCHAR,
-- map of string to struct
MAP(
VARCHAR,
STRUCT(
status VARCHAR,
changed INTEGER
)
)
)
);
We should have either syntax or functions that we could use to have the same result
Since we mirror the behavior from duckdb for struct and map mostly, I prefer we switch to duckdb syntax for them in datafusion, so we can check against the result with copy&paste easily
TODO:
Support syntax for struct in map CREATE TABLE tb2 (col MAP(INTEGER,STRUCT(a INTEGER, b VARCHAR)))
Activity
jayzhan211 commentedon Aug 9, 2024
We need to support such syntax in sqlparser.
List of struct is tracked in apache/datafusion-sqlparser-rs#1372
Since we mirror the behavior from duckdb for struct and map mostly, I prefer we switch to duckdb syntax for them in datafusion, so we can check against the result with copy&paste easily
TODO:
CREATE TABLE tb2 (col MAP(INTEGER,STRUCT(a INTEGER, b VARCHAR)))alamb commentedon Feb 13, 2025
I think this is woring wekk now