Skip to content
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
4 changes: 2 additions & 2 deletions pyiceberg/table/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def _partition_summaries_to_rows(
partition_field_type, from_bytes(partition_field_type, field_summary.lower_bound)
)
)
if field_summary.lower_bound
if field_summary.lower_bound is not None
else None
)
upper_bound = (
Expand All @@ -432,7 +432,7 @@ def _partition_summaries_to_rows(
partition_field_type, from_bytes(partition_field_type, field_summary.upper_bound)
)
)
if field_summary.upper_bound
if field_summary.upper_bound is not None
else None
)
rows.append(
Expand Down
13 changes: 13 additions & 0 deletions tests/table/test_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
import pytest

from pyiceberg.conversions import to_bytes
from pyiceberg.partitioning import PartitionField, PartitionSpec
from pyiceberg.schema import Schema
from pyiceberg.table.inspect import _readable_bound
from pyiceberg.transforms import IdentityTransform
from pyiceberg.types import NestedField, StringType
from tests.catalog.test_base import InMemoryCatalog

Expand Down Expand Up @@ -68,3 +70,14 @@ def test_inspect_entries_and_files_render_null_bound(catalog: InMemoryCatalog) -
files_metrics = tbl.inspect.files().to_pydict()["readable_metrics"][0]["s"]
assert files_metrics["lower_bound"] is None
assert files_metrics["upper_bound"] is None


def test_inspect_manifests_preserves_empty_string_bounds(catalog: InMemoryCatalog) -> None:
schema = Schema(NestedField(1, "s", StringType(), required=False))
spec = PartitionSpec(PartitionField(1, 1000, IdentityTransform(), "s"))
tbl = catalog.create_table("default.empty_string_partition", schema, partition_spec=spec)
tbl.append(pa.table({"s": [""]}, schema=pa.schema([pa.field("s", pa.large_string(), nullable=True)])))

partition_summary = tbl.inspect.manifests().to_pydict()["partition_summaries"][0][0]
assert partition_summary["lower_bound"] == ""
assert partition_summary["upper_bound"] == ""