File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 11"""Parquet file reader."""
22
33from pathlib import Path
4- from typing import Any
4+ from typing import Any , NamedTuple
55
66import pyarrow .parquet as pq
77from pyarrow .lib import ArrowInvalid
88
99
10+ class RowGroupSize (NamedTuple ):
11+ """Size information for a row group."""
12+
13+ compressed : int
14+ uncompressed : int
15+
16+
1017class RowGroup :
1118 """Class to represent a Parquet row group."""
1219
@@ -71,14 +78,13 @@ def has_compression(self) -> bool:
7178 return False
7279
7380 @property
74- def total_sizes (self ) -> tuple [ int , int ] :
81+ def total_sizes (self ) -> RowGroupSize :
7582 """
7683 Get total compressed and uncompressed size of the row group in bytes.
7784
7885 Returns
7986 -------
80- Total compressed and uncompressed size of the row group in bytes.
81- Tuple of (compressed_size, uncompressed_size)
87+ RowGroupSize named tuple with compressed and uncompressed sizes
8288 """
8389 compressed_sum = sum (
8490 self .column (j ).total_compressed_size for j in range (self .num_columns )
@@ -88,7 +94,7 @@ def total_sizes(self) -> tuple[int, int]:
8894 uncompressed_sum = sum (
8995 self .column (j ).total_uncompressed_size for j in range (self .num_columns )
9096 )
91- return compressed_sum , uncompressed_sum
97+ return RowGroupSize ( compressed = compressed_sum , uncompressed = uncompressed_sum )
9298
9399
94100class ParquetReader :
You can’t perform that action at this time.
0 commit comments