-
Notifications
You must be signed in to change notification settings - Fork 407
Support partial deletes #569
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
Merged
Fokko
merged 49 commits into
apache:main
from
Fokko:fd-add-ability-to-delete-full-data-files
Jul 9, 2024
Merged
Changes from 4 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
8d45920
Add option to delete datafiles
Fokko f6084a6
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko 87cc065
Pull in main
Fokko bc9c83e
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko 284d05a
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko 234d55b
WIP
Fokko aadc89c
Change DataScan to accept Metadata and io
Fokko 7e59342
fix name-mapping issue
HonahX fbf6492
Merge pull request #1 from HonahX/honahx-update-datascan
Fokko c3fa7e7
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko a925d69
Merge branch 'fd-update-datascan' of github.com:Fokko/iceberg-python …
Fokko 5cec00a
WIP
Fokko a5e988a
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko 1723819
WIP
Fokko 5025b4a
Moar tests
Fokko e474fda
Oops
Fokko 172f9c0
Cleanup
Fokko a97c45a
WIP
Fokko 74497fb
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko 47c9de1
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko 9c6724e
WIP
Fokko edff166
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko c443af2
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko 7dae071
Fix summary generation
Fokko 5e871fb
Last few bits
Fokko 9910d29
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko cd19f80
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko edfadd9
Fix the requirement
Fokko d65a8a4
Make ruff happy
Fokko 8849d97
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko 3c98eef
Comments, thanks Kevin!
Fokko 179fa27
Comments
Fokko 2ea157e
Append rather than truncate
Fokko 18392d1
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko 7d036b1
Fix merge conflicts
Fokko 5adf3f0
Make the tests pass
Fokko b3fcdcf
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko 4ceacb8
Add another test
Fokko ddf6119
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko 5b10f25
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko 4cd67ac
Conflicts
Fokko 5cdb363
Add docs (#33)
sungwy 2252e71
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko 05fcf2d
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko 1ccb31d
Add a partitioned overwrite test
Fokko 86432fe
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko 259f8c5
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-a…
Fokko 96d6392
Fix comment
Fokko 301bc82
Skip empty manifests
Fokko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| # pylint:disable=redefined-outer-name | ||
| import pytest | ||
| from pyspark.sql import DataFrame, SparkSession | ||
|
|
||
| from pyiceberg.catalog.rest import RestCatalog | ||
| from pyiceberg.expressions import EqualTo | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def test_deletes_table(spark: SparkSession) -> DataFrame: | ||
| identifier = 'default.table_partitioned_delete' | ||
|
|
||
| spark.sql(f"DROP TABLE IF EXISTS {identifier}") | ||
|
|
||
| spark.sql( | ||
| f""" | ||
| CREATE TABLE {identifier} ( | ||
| number_partitioned int, | ||
| number int | ||
| ) | ||
| USING iceberg | ||
| PARTITIONED BY (number_partitioned) | ||
| """ | ||
| ) | ||
| spark.sql( | ||
| f""" | ||
| INSERT INTO {identifier} VALUES (10, 20), (10, 30) | ||
| """ | ||
| ) | ||
| spark.sql( | ||
| f""" | ||
| INSERT INTO {identifier} VALUES (11, 20), (11, 30) | ||
| """ | ||
| ) | ||
|
|
||
| return spark.table(identifier) | ||
|
|
||
|
|
||
| def test_partition_deletes(test_deletes_table: DataFrame, session_catalog: RestCatalog) -> None: | ||
| identifier = 'default.table_partitioned_delete' | ||
|
|
||
| tbl = session_catalog.load_table(identifier) | ||
|
|
||
| with tbl.transaction() as txn: | ||
| with txn.update_snapshot().delete() as delete: | ||
| delete.delete(EqualTo("number_partitioned", 10)) | ||
|
|
||
| assert tbl.scan().to_arrow().to_pydict() == {'number_partitioned': [11, 11], 'number': [20, 30]} | ||
|
|
||
|
|
||
| def test_deletes(test_deletes_table: DataFrame, session_catalog: RestCatalog) -> None: | ||
| identifier = 'default.table_partitioned_delete' | ||
|
|
||
| tbl = session_catalog.load_table(identifier) | ||
|
|
||
| with tbl.transaction() as txn: | ||
| with txn.update_snapshot().delete() as delete: | ||
| delete.delete(EqualTo("number", 30)) | ||
|
|
||
| assert tbl.scan().to_arrow().to_pydict() == {'number_partitioned': [11, 11], 'number': [20, 30]} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.