|
39 | 39 | from concurrent.futures import Future |
40 | 40 | from copy import copy |
41 | 41 | from dataclasses import dataclass |
42 | | -from decimal import Decimal |
43 | 42 | from enum import Enum |
44 | 43 | from functools import lru_cache, singledispatch |
45 | 44 | from typing import ( |
|
176 | 175 | from pyiceberg.utils.concurrent import ExecutorFactory |
177 | 176 | from pyiceberg.utils.config import Config |
178 | 177 | from pyiceberg.utils.datetime import millis_to_datetime |
| 178 | +from pyiceberg.utils.decimal import unscaled_to_decimal |
179 | 179 | from pyiceberg.utils.deprecated import deprecation_message |
180 | 180 | from pyiceberg.utils.properties import get_first_property_value, property_as_bool, property_as_int |
181 | 181 | from pyiceberg.utils.singleton import Singleton |
@@ -2364,15 +2364,9 @@ def data_file_statistics_from_parquet_metadata( |
2364 | 2364 | ) |
2365 | 2365 |
|
2366 | 2366 | if isinstance(stats_col.iceberg_type, DecimalType) and statistics.physical_type != "FIXED_LEN_BYTE_ARRAY": |
2367 | | - precision = stats_col.iceberg_type.precision |
2368 | 2367 | scale = stats_col.iceberg_type.scale |
2369 | | - decimal_type = pa.decimal128(precision, scale) |
2370 | | - col_aggs[field_id].update_min( |
2371 | | - pa.array([Decimal(statistics.min_raw) / (10**scale)], decimal_type)[0].as_py() |
2372 | | - ) |
2373 | | - col_aggs[field_id].update_max( |
2374 | | - pa.array([Decimal(statistics.max_raw) / (10**scale)], decimal_type)[0].as_py() |
2375 | | - ) |
| 2368 | + col_aggs[field_id].update_min(unscaled_to_decimal(statistics.min_raw, scale)) |
| 2369 | + col_aggs[field_id].update_max(unscaled_to_decimal(statistics.max_raw, scale)) |
2376 | 2370 | else: |
2377 | 2371 | col_aggs[field_id].update_min(statistics.min) |
2378 | 2372 | col_aggs[field_id].update_max(statistics.max) |
|
0 commit comments