From ba75a3ab9ab6211194fe3962413111aa5779d375 Mon Sep 17 00:00:00 2001 From: guptaakashdeep Date: Thu, 10 Apr 2025 01:24:01 +0530 Subject: [PATCH 1/2] Fix for metadata entries table for MOR tables containing Delete Files. --- pyiceberg/table/inspect.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pyiceberg/table/inspect.py b/pyiceberg/table/inspect.py index 09d1d7231a..fd0d3069bf 100644 --- a/pyiceberg/table/inspect.py +++ b/pyiceberg/table/inspect.py @@ -205,9 +205,13 @@ def _readable_metrics_struct(bound_type: PrimitiveType) -> pa.StructType: "record_count": entry.data_file.record_count, "file_size_in_bytes": entry.data_file.file_size_in_bytes, "column_sizes": dict(entry.data_file.column_sizes), - "value_counts": dict(entry.data_file.value_counts), - "null_value_counts": dict(entry.data_file.null_value_counts), - "nan_value_counts": dict(entry.data_file.nan_value_counts), + "value_counts": dict(entry.data_file.value_counts) if entry.data_file.value_counts else {}, + "null_value_counts": dict(entry.data_file.null_value_counts) + if entry.data_file.null_value_counts + else {}, + "nan_value_counts": dict(entry.data_file.nan_value_counts) + if entry.data_file.nan_value_counts + else {}, "lower_bounds": entry.data_file.lower_bounds, "upper_bounds": entry.data_file.upper_bounds, "key_metadata": entry.data_file.key_metadata, From c1aa3f262ebd996d97cdfc3c6a75053bd01ba2d1 Mon Sep 17 00:00:00 2001 From: guptaakashdeep Date: Tue, 15 Apr 2025 22:01:32 +0530 Subject: [PATCH 2/2] Updated to more precised syntax. --- pyiceberg/table/inspect.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pyiceberg/table/inspect.py b/pyiceberg/table/inspect.py index fd0d3069bf..878ae71c81 100644 --- a/pyiceberg/table/inspect.py +++ b/pyiceberg/table/inspect.py @@ -205,13 +205,9 @@ def _readable_metrics_struct(bound_type: PrimitiveType) -> pa.StructType: "record_count": entry.data_file.record_count, "file_size_in_bytes": entry.data_file.file_size_in_bytes, "column_sizes": dict(entry.data_file.column_sizes), - "value_counts": dict(entry.data_file.value_counts) if entry.data_file.value_counts else {}, - "null_value_counts": dict(entry.data_file.null_value_counts) - if entry.data_file.null_value_counts - else {}, - "nan_value_counts": dict(entry.data_file.nan_value_counts) - if entry.data_file.nan_value_counts - else {}, + "value_counts": dict(entry.data_file.value_counts or {}), + "null_value_counts": dict(entry.data_file.null_value_counts or {}), + "nan_value_counts": dict(entry.data_file.nan_value_counts or {}), "lower_bounds": entry.data_file.lower_bounds, "upper_bounds": entry.data_file.upper_bounds, "key_metadata": entry.data_file.key_metadata,