Skip to content

Incorrect implicit casting with duckdb 1.4.1 #148

Closed

Description

@AlexHelloWorld

What happens?

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

In DuckDB 1.3.2, we got

pyarrow.Table
list_extract(string_split(str_col, '-'), 1): string
----
list_extract(string_split(str_col, '-'), 1): [["1","3","a",null]]

To 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)

OS:

linux

DuckDB Version:

1.4.1

DuckDB Client:

Python

Hardware:

No response

Full Name:

Hongyu Shi

Affiliation:

Benchling

Did you include all relevant configuration (e.g., CPU architecture, Linux distribution) to reproduce the issue?

  • Yes, I have

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant data sets for reproducing the issue?

Yes

Activity

  1. transferred this issue fromduckdb/duckdbon Oct 31, 2025
  2. evertlammerts commented on Oct 31, 2025

    @evertlammerts
    Member

    On v1.4.1:

    ❯ 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                                        │
    └─────────────────────────────────────────────┘
    
  3. taniabogatsch commented on Oct 31, 2025

    @taniabogatsch
    Member

    I'll have a shot at this, since it's a duckdb/duckdb error (not Python). 👍

  4. added a commit that references this issue on Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions