deanm0000 opened a new issue, #37604:
URL: https://github.com/apache/arrow/issues/37604

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   If I do
   
   ```
   import polars as pl
   import pyarrow.parquet as pq
   df=pl.DataFrame({'a':[1,2,3]})
   df.write_parquet("blah.parquet", statistics=True)
   pq.ParquetFile("blah.parquet").metadata.row_group(0).column(0)
   #   is_stats_set: True
   #   statistics:
   #     <pyarrow._parquet.Statistics object at 0x7f10c051f100>
   #       has_min_max: False
   #       min: None
   #       max: None
   #       null_count: 0
   #       distinct_count: 0
   #       num_values: 3
   #       physical_type: INT64
   #       logical_type: None
   #       converted_type (legacy): NONE
   ```
   
   This is just showing that there is no min/max but I was under the impression 
that pyarrow favors min_value/max_value and only uses min/max as a fallback if 
min_value/max_value are missing. Perhaps it does that in predicate pushdown but 
the metadata that it reports here should either include both sets of statistics 
or use the same behavior.
   
   For instance from the cli
   
   ```
   parquet-tools inspect blah.parquet --detail
   ■■■■■■■■■■■■■■■■■■■■■■■■statistics = Statistics
   ■■■■■■■■■■■■■■■■■■■■■■■■■■■■max_value = b'\x03\x00\x00\x00\x00\x00\x00\x00'
   ■■■■■■■■■■■■■■■■■■■■■■■■■■■■min_value = b'\x01\x00\x00\x00\x00\x00\x00\x00'
   ```
   
   shows that the file does indeed have its min_value and max_value set.
   
   If I save the file with pyarrow and then use parquet-tools on it...
   
   
   ```
   pq.write_table(df.to_arrow(), "blahpa.parquet", compression='zstd')
   ###then in cli
   parquet-tools inspect blahpa.parquet --detail
   ■■■■■■■■■■■■■■■■■■■■■■■■statistics = Statistics
   ■■■■■■■■■■■■■■■■■■■■■■■■■■■■max = b'\x03\x00\x00\x00\x00\x00\x00\x00'
   ■■■■■■■■■■■■■■■■■■■■■■■■■■■■min = b'\x01\x00\x00\x00\x00\x00\x00\x00'
   ■■■■■■■■■■■■■■■■■■■■■■■■■■■■max_value = b'\x03\x00\x00\x00\x00\x00\x00\x00'
   ■■■■■■■■■■■■■■■■■■■■■■■■■■■■min_value = b'\x01\x00\x00\x00\x00\x00\x00\x00'
   ```
   
   so pyarrow is writing both sets of stats and apparently, at least for the 
purpose of pq.metadata, only reporting the deprecated stats. It probably 
could/should stop writing the deprecated stats and the metadata reporting tool 
should show and make use of the new stats.
   
   ### Component(s)
   
   Python


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to