Skip to content

Commit fc19c7b

Browse files
committed
fix(inspect): handle 4-byte bounds in _readable_bound after int/float type promotion (#3744)
1 parent d12f680 commit fc19c7b

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

‎tests/table/test_inspect.py‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17-
1817
from pathlib import PosixPath
1918
from typing import Any
2019

@@ -29,7 +28,7 @@
2928
from pyiceberg.table.snapshots import Snapshot
3029
from pyiceberg.transforms import IdentityTransform
3130
from pyiceberg.typedef import Record
32-
from pyiceberg.types import NestedField, StringType
31+
from pyiceberg.types import DoubleType, LongType, NestedField, StringType
3332
from tests.catalog.test_base import InMemoryCatalog
3433

3534

@@ -106,3 +105,16 @@ def test_inspect_manifests_preserves_empty_string_bounds(catalog: InMemoryCatalo
106105
partition_summary = tbl.inspect.manifests().to_pydict()["partition_summaries"][0][0]
107106
assert partition_summary["lower_bound"] == ""
108107
assert partition_summary["upper_bound"] == ""
108+
109+
def test_readable_bound_type_promotions() -> None:
110+
# 4-byte LE representation of integer 10 -> b'\x0a\x00\x00\x00'
111+
four_byte_int_bound = b"\x0a\x00\x00\x00"
112+
113+
# 4-byte LE representation of float 10.0 -> b'\x00\x00\x20\x41'
114+
four_byte_float_bound = b"\x00\x00\x20\x41"
115+
116+
# Test int -> long promotion decoding
117+
assert _readable_bound(LongType(), four_byte_int_bound) == 10
118+
119+
# Test float -> double promotion decoding
120+
assert _readable_bound(DoubleType(), four_byte_float_bound) == 10.0

0 commit comments

Comments
 (0)