|
14 | 14 | # KIND, either express or implied. See the License for the |
15 | 15 | # specific language governing permissions and limitations |
16 | 16 | # under the License. |
17 | | - |
18 | 17 | from pathlib import PosixPath |
19 | 18 | from typing import Any |
20 | 19 |
|
|
29 | 28 | from pyiceberg.table.snapshots import Snapshot |
30 | 29 | from pyiceberg.transforms import IdentityTransform |
31 | 30 | from pyiceberg.typedef import Record |
32 | | -from pyiceberg.types import NestedField, StringType |
| 31 | +from pyiceberg.types import DoubleType, LongType, NestedField, StringType |
33 | 32 | from tests.catalog.test_base import InMemoryCatalog |
34 | 33 |
|
35 | 34 |
|
@@ -106,3 +105,16 @@ def test_inspect_manifests_preserves_empty_string_bounds(catalog: InMemoryCatalo |
106 | 105 | partition_summary = tbl.inspect.manifests().to_pydict()["partition_summaries"][0][0] |
107 | 106 | assert partition_summary["lower_bound"] == "" |
108 | 107 | 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