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

Python: Table scan returning deleted data #6568

Closed
erikcw opened this issue Jan 11, 2023 · 2 comments · Fixed by #6775
Closed

Python: Table scan returning deleted data #6568

erikcw opened this issue Jan 11, 2023 · 2 comments · Fixed by #6775

Comments

@erikcw
Copy link

erikcw commented Jan 11, 2023

Apache Iceberg version

1.1.0 (latest release)

Query engine

Other

Please describe the bug 🐞

I originally mentioned raised this issue in #6567. After deleting rows from a table (in my case with Athena), pyiceberg is still returning parquet files with those records from a table scan. Shouldn't those files no longer be in the current manifest and hence not returned my the table scan?

-- Executed in Athena
DELETE FROM iceberg_test WHERE uid = '200441';

select count(uid) from "iceberg_test"
where uid = '200441';

-- Returns 0.
    # Glue catalog type.
    catalog = load_catalog("default")
    table = catalog.load_table("testing.iceberg_test")

    scan = table.scan(
        row_filter=NotEqualTo("uid", "200441"),  # Doesn't seem to make a difference with or without this line.
        selected_fields=("uid"),
    )
    files = [task.file.file_path for task in scan.plan_files()]
    # files all contain the deleted value.
@Fokko Fokko changed the title pyiceberg table scan returning deleted data Python: Table scan returning deleted data Jan 12, 2023
@Fokko Fokko added the python label Jan 12, 2023
@Fokko
Copy link
Contributor

Fokko commented Jan 12, 2023

It looks like the delete strategy is merge-on-read (more information on the strategies can be found here), and this requires PyIceberg to filter out the deleted rows when reading the data.

@Fokko Fokko added this to the Python 0.4.0 release milestone Jan 25, 2023
Fokko added a commit to Fokko/iceberg that referenced this issue Feb 8, 2023
Fokko added a commit to Fokko/iceberg that referenced this issue Feb 8, 2023
Fokko added a commit to Fokko/iceberg that referenced this issue Feb 8, 2023
Fokko added a commit to Fokko/iceberg that referenced this issue Feb 8, 2023
Fokko added a commit to Fokko/iceberg that referenced this issue Feb 8, 2023
Fokko added a commit to Fokko/iceberg that referenced this issue Feb 9, 2023
Fokko added a commit to Fokko/iceberg that referenced this issue Feb 9, 2023
Fokko added a commit to Fokko/iceberg that referenced this issue Feb 9, 2023
@Fokko
Copy link
Contributor

Fokko commented May 11, 2023

This is already fixed:

image

It throws an error now. The upcoming 0.4.0 release will support actual positional deletes.

@Fokko Fokko closed this as completed May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants