@@ -16,17 +16,18 @@ def test_null_type(self, duckdb_cursor):
1616 # NULL type now round-trips faithfully (previously it was coerced to int32)
1717 assert rel ["data" ] == arrow_table ["data" ]
1818
19- def test_invalid_struct (self , duckdb_cursor ):
19+ def test_empty_struct (self , duckdb_cursor ):
20+ # Empty structs are now supported by DuckDB core. This previously raised
21+ # "Attempted to convert a STRUCT with no fields to DuckDB which is not supported";
22+ # the core check was removed and empty structs now round-trip faithfully.
2023 empty_struct_type = pa .struct ([])
21-
22- # Create an empty array with the defined struct type
23- empty_array = pa .array ([], type = empty_struct_type )
24- arrow_table = pa .Table .from_arrays ([empty_array ], schema = pa .schema ([("data" , empty_struct_type )])) # noqa: F841
25- with pytest .raises (
26- duckdb .InvalidInputException ,
27- match = "Attempted to convert a STRUCT with no fields to DuckDB which is not supported" ,
28- ):
29- duckdb_cursor .sql ("select * from arrow_table" ).fetchall ()
24+ arrow_table = pa .Table .from_arrays ( # noqa: F841
25+ [pa .array ([None , None ], type = empty_struct_type )],
26+ schema = pa .schema ([("data" , empty_struct_type )]),
27+ )
28+ result = duckdb_cursor .sql ("select * from arrow_table" ).to_arrow_table ()
29+ assert result ["data" ].type == empty_struct_type
30+ assert result ["data" ].to_pylist () == [None , None ]
3031
3132 def test_invalid_union (self , duckdb_cursor ):
3233 # Create a sparse union array from dense arrays
0 commit comments