Skip to content

Simple query fails with column types must match schema types #13534

@adriangb

Description

@adriangb

Describe the bug

Found in our production system using datafusion internals, but reproducible in datafusion-cli:

SELECT
    'foo' AS text,
    arrow_cast('2024-01-01T00:00:00Z'::timestamptz, 'Timestamp(Microsecond, Some("UTC"))') AS ts
GROUP BY ts, text

Gives:

Arrow error: Invalid argument error: column types must match schema types, expected Timestamp(Microsecond, Some("UTC")) but found Timestamp(Microsecond, None) at column index 0

To Reproduce

No response

Expected behavior

No response

Additional context

I bisected it with this script:

pushd datafusion-cli && cargo run --bin datafusion-cli -- --file ../q.sql && popd

And then:

git checkout c0ca4b4  # current HEAD
git bisect start
git bisect bad
git checkout 88f58bf # 43.0, I manually verified it is okay
git bisect good
git bisect run ./test.sh  # the above script

The result points to ecc04d4 / #13457

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions