Skip to content

Commit 5637eee

Browse files
committed
Add Workaround to PyArrow bug #47955 with Deciaml INT32/INT64 statistics
1 parent da34885 commit 5637eee

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

src/datanomy/tui/parquet.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -615,10 +615,28 @@ def _build_column_stats_text(self, col_idx: int) -> Text:
615615

616616
# Min/Max
617617
if stats.has_min_max:
618-
col_text.append(" min: ", style="bold")
619-
col_text.append(f"{stats.min}\n", style="green")
620-
col_text.append(" max: ", style="bold")
621-
col_text.append(f"{stats.max}\n", style="green")
618+
# WORKAROUND for PyArrow < 23.0.0 bug with DECIMAL INT32/INT64 statistics
619+
# See: https://github.com/apache/arrow/issues/47955
620+
# TODO: Remove this workaround once PyArrow 23.0.0 is released
621+
physical_type = col_chunk.physical_type
622+
logical_type = stats.logical_type
623+
is_decimal_int = (
624+
logical_type is not None
625+
and "Decimal" in str(logical_type)
626+
and physical_type in ("INT32", "INT64")
627+
)
628+
629+
if is_decimal_int:
630+
# Skip min/max display for DECIMAL with INT32/INT64 - known PyArrow bug
631+
col_text.append(
632+
" min/max: Not available (PyArrow bug GH-47955)\n",
633+
style="dim yellow",
634+
)
635+
else:
636+
col_text.append(" min: ", style="bold")
637+
col_text.append(f"{stats.min}\n", style="green")
638+
col_text.append(" max: ", style="bold")
639+
col_text.append(f"{stats.max}\n", style="green")
622640

623641
# Null count
624642
if stats.has_null_count:

0 commit comments

Comments
 (0)