|
2 | 2 |
|
3 | 3 | from __future__ import annotations
|
4 | 4 |
|
5 |
| -import fsspec.parquet |
6 | 5 | import hashlib
|
7 | 6 | import json
|
8 | 7 |
|
| 8 | +import fsspec.parquet |
| 9 | + |
9 | 10 | import awkward as ak
|
10 | 11 | import awkward._connect.pyarrow
|
11 | 12 | from awkward._dispatch import high_level_function
|
@@ -67,12 +68,8 @@ def from_parquet(
|
67 | 68 | See also #ak.to_parquet, #ak.metadata_from_parquet.
|
68 | 69 | """
|
69 | 70 |
|
70 |
| - parquet_columns, subform, actual_paths, fs, subrg, row_counts, meta, uuid = metadata( |
71 |
| - path, |
72 |
| - storage_options, |
73 |
| - row_groups, |
74 |
| - columns, |
75 |
| - calculate_uuid=True |
| 71 | + parquet_columns, subform, actual_paths, fs, subrg, row_counts, meta, uuid = ( |
| 72 | + metadata(path, storage_options, row_groups, columns, calculate_uuid=True) |
76 | 73 | )
|
77 | 74 | return _load(
|
78 | 75 | actual_paths,
|
@@ -197,15 +194,24 @@ def metadata(
|
197 | 194 | list_indicator=list_indicator, column_prefix=column_prefix
|
198 | 195 | )
|
199 | 196 |
|
200 |
| - #generate hash from the col_counts, first row_group and last row_group to calculate approximate parquet uuid |
| 197 | + # generate hash from the col_counts, first row_group and last row_group to calculate approximate parquet uuid |
201 | 198 | uuid = None
|
202 | 199 | if calculate_uuid:
|
203 | 200 | uuids = [str(col_counts)]
|
204 | 201 | for row_group_index in (0, metadata.num_row_groups - 1):
|
205 | 202 | row_group_info = metadata.row_group(row_group_index)
|
206 | 203 | uuids.append(repr(row_group_info.to_dict()))
|
207 | 204 | uuid = hashlib.sha256(json.dumps(",".join(uuids)).encode()).hexdigest()
|
208 |
| - return parquet_columns, subform, actual_paths, fs, subrg, col_counts, metadata, uuid |
| 205 | + return ( |
| 206 | + parquet_columns, |
| 207 | + subform, |
| 208 | + actual_paths, |
| 209 | + fs, |
| 210 | + subrg, |
| 211 | + col_counts, |
| 212 | + metadata, |
| 213 | + uuid, |
| 214 | + ) |
209 | 215 |
|
210 | 216 | return parquet_columns, subform, actual_paths, fs, subrg, col_counts, metadata
|
211 | 217 |
|
|
0 commit comments