Skip to content

[Append Scan] Integration tests for IncrementalAppendScan #2235

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions dev/provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,3 +409,58 @@
)
spark.sql(f"ALTER TABLE {catalog_name}.default.test_empty_scan_ordered_str WRITE ORDERED BY id")
spark.sql(f"INSERT INTO {catalog_name}.default.test_empty_scan_ordered_str VALUES 'a', 'c'")

spark.sql(
f"""
CREATE OR REPLACE TABLE {catalog_name}.default.test_incremental_read (
dt date,
number integer,
letter string
)
USING iceberg
TBLPROPERTIES (
'format-version'='2'
);
"""
)

spark.sql(
f"""
INSERT INTO {catalog_name}.default.test_incremental_read
VALUES (CAST('2022-03-01' AS date), 1, 'a')
"""
)

spark.sql(
f"""
INSERT INTO {catalog_name}.default.test_incremental_read
VALUES (CAST('2022-03-01' AS date), 2, 'b')
"""
)

spark.sql(
f"""
INSERT INTO {catalog_name}.default.test_incremental_read
VALUES (CAST('2022-03-02' AS date), 3, 'c'), (CAST('2022-03-02' AS date), 4, 'b')
"""
)

spark.sql(
f"""
DELETE FROM {catalog_name}.default.test_incremental_read
WHERE number = 2
"""
)

# https://github.com/apache/iceberg/issues/1092#issuecomment-638432848 / https://github.com/apache/iceberg/issues/3747#issuecomment-1145419407
# Don't do replace for Hive catalog as REPLACE TABLE requires certain Hive server configuration
if catalog_name != "hive":
# Replace to break snapshot lineage:
spark.sql(
f"""
REPLACE TABLE {catalog_name}.default.test_incremental_read
USING iceberg
TBLPROPERTIES ('format-version'='2')
AS SELECT number, letter FROM {catalog_name}.default.test_incremental_read
"""
)
8 changes: 8 additions & 0 deletions pyiceberg/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,14 @@ def fetch_manifest_entry(self, io: FileIO, discard_deleted: bool = True) -> List
if not discard_deleted or entry.status != ManifestEntryStatus.DELETED
]

def __eq__(self, other: Any) -> bool:
"""Return the equality of two instances of the ManifestFile class."""
return self.manifest_path == other.manifest_path if isinstance(other, ManifestFile) else False

def __hash__(self) -> int:
"""Return the hash of manifest_path."""
return hash(self.manifest_path)


@cached(cache=LRUCache(maxsize=128), key=lambda io, manifest_list: hashkey(manifest_list))
def _manifests(io: FileIO, manifest_list: str) -> Tuple[ManifestFile, ...]:
Expand Down
Loading