Fokko commented on code in PR #1799: URL: https://github.com/apache/iceberg-python/pull/1799#discussion_r2000526902
########## pyiceberg/io/pyarrow.py: ########## @@ -2335,9 +2340,18 @@ def data_file_statistics_from_parquet_metadata( col_aggs[field_id] = StatsAggregator( stats_col.iceberg_type, statistics.physical_type, stats_col.mode.length ) - - col_aggs[field_id].update_min(statistics.min) - col_aggs[field_id].update_max(statistics.max) + matches=DECIMAL_REGEX.search(str(stats_col.iceberg_type)) + if matches and statistics.physical_type != "FIXED_LEN_BYTE_ARRAY": + precision=int(matches.group(1)) + scale=int(matches.group(2)) + local_context = Context(prec=precision) + decoded_min = local_context.create_decimal(Decimal(statistics.min_raw)/ (10 ** scale)) + decoded_max = local_context.create_decimal(Decimal(statistics.max_raw)/ (10 ** scale)) + col_aggs[field_id].update_min(decoded_min) + col_aggs[field_id].update_max(decoded_max) + else: + col_aggs[field_id].update_min(statistics.min) + col_aggs[field_id].update_max(statistics.max) Review Comment: When we `isinstanceof` the `stats_col.iceberg_Type` as a `DecimalType`, then we have access to the `scale` and `precision`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org