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
When SET old_implicit_casting = true;, list type was casted to string unexpectedly, leading to incorrect results with list_extract. This seems to be a regression in 1.4.x as DuckDB 1.3.x works fine.
Reproduce:
import duckdb
import pyarrow as pa
data = {
"str_col": ["1-2", "3-4", "a-z", None]
}
arrow_table = pa.table(data)
conn = duckdb.connect(":memory:")
conn.execute("SET old_implicit_casting = true;")
conn.register("input", arrow_table)
result1 = conn.execute("SELECT list_extract(string_split(str_col, '-'), 1) FROM input").fetch_arrow_table()
print(result1)
In DuckDB 1.4.0 and 1.4.1, we got
pyarrow.Table
list_extract(string_split(str_col, '-'), 1): string
----
list_extract(string_split(str_col, '-'), 1): [["[","[","[",null]] # instead of the first element of list, the first character "[" was returned
❯ duckdb
DuckDB v1.4.1 (Andium) b390a7c376
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D SET old_implicit_casting = true;
D SELECT list_extract(string_split(str_col, '-'), 1) FROM (VALUES('1-2'), ('3-4'), ('a-z'), (NULL)) as t(str_col);
┌─────────────────────────────────────────────┐
│ list_extract(string_split(str_col, '-'), 1) │
│ varchar │
├─────────────────────────────────────────────┤
│ [ │
│ [ │
│ [ │
│ NULL │
└─────────────────────────────────────────────┘
On v1.3.2:
DuckDB v1.3.2 (Ossivalis) 0b83e5d2f6
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D SET old_implicit_casting = true;
D SELECT list_extract(string_split(str_col, '-'), 1) FROM (VALUES('1-2'), ('3-4'), ('a-z'), (NULL)) as t(str_col);
┌─────────────────────────────────────────────┐
│ list_extract(string_split(str_col, '-'), 1) │
│ varchar │
├─────────────────────────────────────────────┤
│ 1 │
│ 3 │
│ a │
│ NULL │
└─────────────────────────────────────────────┘
Activity
evertlammerts commentedon Oct 31, 2025
On v1.4.1:
On v1.3.2:
taniabogatsch commentedon Oct 31, 2025
I'll have a shot at this, since it's a duckdb/duckdb error (not Python). 👍
Increase cast-cost of old-style implicit cast to string (#19621)
Upstream v1.4.2