Skip to content

Commit fe468f7

Browse files
committed
Add test for StasisticsFile
1 parent 654abef commit fe468f7

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

tests/table/test_statistics.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17-
from pyiceberg.table.statistics import PartitionStatisticsFile
17+
from pyiceberg.table.statistics import BlobMetadata, PartitionStatisticsFile, StatisticsFile
1818

1919

2020
def test_partition_statistics_file() -> None:
@@ -28,3 +28,27 @@ def test_partition_statistics_file() -> None:
2828
)
2929

3030
assert partition_statistics_file.model_dump_json() == partition_statistics_file_json
31+
32+
33+
def test_statistics_file() -> None:
34+
statistics_file_json = """{"snapshot-id":123,"statistics-path":"s3://bucket/statistics.parquet","file-size-in-bytes":345,"file-footer-size-in-bytes":456,"blob-metadata":[{"type":"apache-datasketches-theta-v1","snapshot-id":567,"sequence-number":22,"fields":[1,2,3],"properties":{"foo":"bar"}}]}"""
35+
statistics_file = StatisticsFile.model_validate_json(statistics_file_json)
36+
37+
assert statistics_file == StatisticsFile(
38+
snapshot_id=123,
39+
statistics_path="s3://bucket/statistics.parquet",
40+
file_size_in_bytes=345,
41+
file_footer_size_in_bytes=456,
42+
key_metadata=None,
43+
blob_metadata=[
44+
BlobMetadata(
45+
type="apache-datasketches-theta-v1",
46+
snapshot_id=567,
47+
sequence_number=22,
48+
fields=[1, 2, 3],
49+
properties={"foo": "bar"},
50+
)
51+
],
52+
)
53+
54+
assert statistics_file.model_dump_json() == statistics_file_json

0 commit comments

Comments
 (0)