Skip to content

Commit 137a9de

Browse files
committed
So clean
1 parent 68fafeb commit 137a9de

3 files changed

Lines changed: 8 additions & 15 deletions

File tree

pyiceberg/manifest.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from enum import Enum
2323
from types import TracebackType
2424
from typing import (
25-
TYPE_CHECKING,
2625
Any,
2726
Dict,
2827
Iterator,
@@ -59,9 +58,6 @@
5958
StructType,
6059
)
6160

62-
if TYPE_CHECKING:
63-
pass
64-
6561
UNASSIGNED_SEQ = -1
6662
DEFAULT_BLOCK_SIZE = 67108864 # 64 * 1024 * 1024
6763
DEFAULT_READ_VERSION: Literal[2] = 2
@@ -989,12 +985,12 @@ def _inherit_from_manifest(entry: ManifestEntry, manifest: ManifestFile) -> Mani
989985

990986
# in v1 tables, the sequence number is not persisted and can be safely defaulted to 0
991987
# in v2 tables, the sequence number should be inherited iff the entry status is ADDED
992-
if entry.sequence_number is None:
988+
if entry.sequence_number is None and (manifest.sequence_number == 0 or entry.status == ManifestEntryStatus.ADDED):
993989
entry.sequence_number = manifest.sequence_number
994990

995991
# in v1 tables, the file sequence number is not persisted and can be safely defaulted to 0
996992
# in v2 tables, the file sequence number should be inherited iff the entry status is ADDED
997-
if entry.file_sequence_number is None:
993+
if entry.file_sequence_number is None and (manifest.sequence_number == 0 or entry.status == ManifestEntryStatus.ADDED):
998994
# Only available in V2, always 0 in V1
999995
entry.file_sequence_number = manifest.sequence_number
1000996

tests/catalog/test_sql.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,11 +1440,11 @@ def test_concurrent_commit_table(catalog: SqlCatalog, table_schema_simple: Schem
14401440
"catalog",
14411441
[
14421442
lazy_fixture("catalog_memory"),
1443-
# lazy_fixture("catalog_sqlite"),
1444-
# lazy_fixture("catalog_sqlite_without_rowcount"),
1443+
lazy_fixture("catalog_sqlite"),
1444+
lazy_fixture("catalog_sqlite_without_rowcount"),
14451445
],
14461446
)
1447-
@pytest.mark.parametrize("format_version", [2])
1447+
@pytest.mark.parametrize("format_version", [1, 2])
14481448
def test_write_and_evolve(catalog: SqlCatalog, format_version: int) -> None:
14491449
identifier = f"default.arrow_write_data_and_evolve_schema_v{format_version}"
14501450

tests/utils/test_manifest.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -525,12 +525,9 @@ def test_write_manifest(
525525
assert data_file.sort_order_id == 0
526526

527527

528-
# @pytest.mark.parametrize("format_version", [1, 2])
529-
@pytest.mark.parametrize("format_version", [2])
530-
# @pytest.mark.parametrize("parent_snapshot_id", [19, None])
531-
@pytest.mark.parametrize("parent_snapshot_id", [19,])
532-
# @pytest.mark.parametrize("compression", ["null", "deflate"])
533-
@pytest.mark.parametrize("compression", ["null"])
528+
@pytest.mark.parametrize("format_version", [1, 2])
529+
@pytest.mark.parametrize("parent_snapshot_id", [19, None])
530+
@pytest.mark.parametrize("compression", ["null", "deflate"])
534531
def test_write_manifest_list(
535532
generated_manifest_file_file_v1: str,
536533
generated_manifest_file_file_v2: str,

0 commit comments

Comments
 (0)