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
Python SDK read_parquet union_by_name fail after version 1.2.2 #259
Regression in 1.3.0+: union_by_name fails with "Can't change source type (NULL) to target type (VARCHAR[])" when reading parquet files with mixed NULL/LIST types
DuckDB Version
Working version: 1.2.2
Broken versions: 1.3.0, 1.3.1 (and later)
Environment
OS: Linux
Python: 3.12.9
pandas: (latest)
Description
Starting with DuckDB 1.3.0, reading multiple parquet files with union_by_name=True fails when:
Some parquet files have a column stored as NULL type (because all values are null in that file)
Other parquet files have the same column properly typed as VARCHAR[] (array/list of strings)
This worked correctly in DuckDB 1.2.2 but now throws:
BinderException: Binder Error: Can't change source type ("NULL") to target type (VARCHAR[]), type conversion not allowed
Expected Behavior
When union_by_name=True is set, DuckDB should merge schemas gracefully, treating NULL-typed columns as compatible with any target type (similar to how pandas handles this).
Actual Behavior
DuckDB 1.3.0+ throws a BinderException and refuses to read the files, even though union_by_name=True is explicitly designed to handle schema variations across multiple files.
Root Cause Analysis
Investigation shows:
When a parquet file has ALL NULL values for a column, it's stored with NULL type (e.g., INT32 with NullType() logical type)
Other files with actual data store the same column as BYTE_ARRAY with StringType() or complex types like ListType()
The error specifically mentions VARCHAR[] (array type) suggesting it happens with nested/complex types
This regression appeared between versions 1.2.2 and 1.3.0
(not sure which issue to post in, one of them is a dupe):
Doesn't this same error/inability to union occur with base duckdb?
❯ 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 select * from read_parquet('*.parquet', union_by_name=True)
┬╖ ;
Binder Error:
Struct remap can only remap nested types, not '"NULL"'
D
Note: reproduced that this would work in 1.2.2 but not in 1.3.0+ through 1.4.3.
@paultiq yes same error raised in cli v1.4.3
I didn't notice my cli was in older version and missed this.
cli v.14.3 raises error
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 select * from read_parquet('*.parquet', union_by_name=True)
;
Binder Error:
Struct remap can only remap nested types, not '"NULL"'
import pathlib
import tempfile
import duckdb
import pyarrow as pa
import pyarrow.parquet as pq
print(f"duckdb {duckdb.__version__}, pyarrow {pa.__version__}")
tmp = pathlib.Path(tempfile.mkdtemp())
# f1.parquet: struct field `d.b` has Arrow type `null`
f1 = pa.table({
"k": [1],
"d": pa.array(
[{"a": "x", "b": None}],
type=pa.struct([("a", pa.string()), ("b", pa.null())]),
),
})
# f2.parquet: the same field `d.b` has type `list<string>`
f2 = pa.table({
"k": [2],
"d": pa.array(
[{"a": "y", "b": ["p"]}],
type=pa.struct([("a", pa.string()), ("b", pa.list_(pa.string()))]),
),
})
pq.write_table(f1, tmp / "f1.parquet")
pq.write_table(f2, tmp / "f2.parquet")
# Expected: d.b unifies to VARCHAR[], with NULL for k=1 and ['p'] for k=2
duckdb.sql(f"""
SELECT *
FROM read_parquet('{tmp}/*.parquet', union_by_name = true)
ORDER BY k
""").show()
This is still broken on v1.5.5:
❯ pbpaste | uv run python
duckdb 1.5.5, pyarrow 25.0.1
Traceback (most recent call last):
File "<stdin>", line 38, in <module>
_duckdb.BinderException: Binder Error: Can't change source type ("NULL") to target type (VARCHAR[]), type conversion not allowed
Activity
Tishj commentedon Jan 8, 2026
Needs to be moved to https://github.com/duckdb/duckdb-python
Could you move it @szarnyasg ?
DaiZack commentedon Jan 8, 2026
@Tishj @szarnyasg Thanks, I created one #257 .
paultiq commentedon Jan 9, 2026
(not sure which issue to post in, one of them is a dupe):
Doesn't this same error/inability to union occur with base duckdb?
Note: reproduced that this would work in 1.2.2 but not in 1.3.0+ through 1.4.3.
DaiZack commentedon Jan 12, 2026
@paultiq yes same error raised in cli v1.4.3
I didn't notice my cli was in older version and missed this.
cli v.14.3 raises error
cli v1.2.2 was working fine
evertlammerts commentedon Apr 9, 2026
Looks like this is fixed in 1.5.x?
evertlammerts commentedon Sep 22, 2026
Here's an MRE:
This is still broken on v1.5.5:
But fixed in the upcoming v2.0, in duckdb/duckdb#25908: