Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot merge into table partitioned by date type column on 0.16.3 #2344

Closed
echai58 opened this issue Mar 26, 2024 · 7 comments · Fixed by #2357
Closed

Cannot merge into table partitioned by date type column on 0.16.3 #2344

echai58 opened this issue Mar 26, 2024 · 7 comments · Fixed by #2357
Labels
bug Something isn't working

Comments

@echai58
Copy link

echai58 commented Mar 26, 2024

Environment

Delta-rs version: 0.16.3

Binding: python


Bug

What happened:
After upgrading to 0.16.3 from 0.15.3, I'm seeing a DeltaError: Generic DeltaTable error: Unable to convert expression to string error when trying to merge into a table that is partitioned by a column of type pa.date32(). If I don't partition by date, or partition by a column of string/int type, the merge succeeds. So it is something to do with date type partitions.

What you expected to happen:
This used to work, so I would expect this behavior to not break in later versions. I'm not sure if this degradation came from 0.16.3 specifically, or some version in between 0.15.3 and now.

How to reproduce it:

import pyarrow as pa
import pandas as pd
from deltalake import DeltaTable

schema = pa.schema(
    [
        ("date", pa.date32()),
        ("k", pa.string()),
        ("v", pa.string()),
    ]
)

DeltaTable.create("test", schema=schema, partition_by=["date"])

t = pd.DataFrame.from_dict(
    {
        "date": [pd.to_datetime("2022-02-01")],
        "k": ["a"],
        "v": ["b"],
    }
)

dt.merge(
    t,
    predicate='s.date = t.date',
    source_alias="s",
    target_alias="t",
).when_matched_update_all().when_not_matched_insert_all().execute()

The above is a minimal reproduction, leading to the following error DeltaError: Generic DeltaTable error: Unable to convert expression to string.

More details:

@echai58 echai58 added the bug Something isn't working label Mar 26, 2024
@ion-elgreco
Copy link
Collaborator

@echai58 would you be able to check at what version this stopped working?

@echai58
Copy link
Author

echai58 commented Mar 26, 2024

@echai58 would you be able to check at what version this stopped working?

@ion-elgreco Yes, just went through versions and it started breaking on 0.16.2, worked on versions before that.

@ion-elgreco
Copy link
Collaborator

@echai58 great, thanks for checking! I'll take a look in the next couple days, it may have to do with the early filter construction

ion-elgreco added a commit that referenced this issue Apr 2, 2024
# Description
We weren't parsing all scalar values yet, parses date32/64 and
timestampmicros now as well.

# Related Issue(s)
- fixes #2344
@echai58
Copy link
Author

echai58 commented Apr 2, 2024

@ion-elgreco thanks for working on a fix for this! Do you have plans to do a new version release with this fix soon? It's blocking me upgrading right now 🙂

@ion-elgreco
Copy link
Collaborator

@ion-elgreco thanks for working on a fix for this! Do you have plans to do a new version release with this fix soon? It's blocking me upgrading right now 🙂

Somewhere next week I guess

@echai58
Copy link
Author

echai58 commented Apr 10, 2024

Hi @ion-elgreco, wanted to follow up and check if there are any updates on when 0.16.5 will be released?

@ion-elgreco
Copy link
Collaborator

Hi @echai58, I want to do a 0.17 release but with these PRs in as well:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants