redpheonixx commented on code in PR #1839:
URL: https://github.com/apache/iceberg-python/pull/1839#discussion_r2021037350


##########
pyiceberg/io/pyarrow.py:
##########
@@ -2350,8 +2351,19 @@ def data_file_statistics_from_parquet_metadata(
                             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)
+                    if isinstance(stats_col.iceberg_type, DecimalType) and 
statistics.physical_type != "FIXED_LEN_BYTE_ARRAY":
+                        precision = stats_col.iceberg_type.precision
+                        scale = stats_col.iceberg_type.scale
+                        decimal_type = pa.decimal128(precision, scale)
+                        col_aggs[field_id].update_min(
+                            pa.array([Decimal(statistics.min_raw) / 
(10**scale)], decimal_type)[0].as_py()
+                        )
+                        col_aggs[field_id].update_max(
+                            pa.array([Decimal(statistics.max_raw) / 
(10**scale)], decimal_type)[0].as_py()
+                        )

Review Comment:
   Hi @Fokko , 
   thanks for the comment
   I have updated the code and used unscale_to_decimal now



-- 
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

Reply via email to