This is an automated email from the ASF dual-hosted git repository.

nevime pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new 857dbaf  Write boolean stats for boolean columns (not i32 stats) (#661)
857dbaf is described below

commit 857dbafcbaa721f22ac485f38ccaff3faf8d2ab9
Author: Andrew Lamb <[email protected]>
AuthorDate: Sun Aug 8 08:32:47 2021 -0400

    Write boolean stats for boolean columns (not i32 stats) (#661)
---
 parquet/src/column/writer.rs | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/parquet/src/column/writer.rs b/parquet/src/column/writer.rs
index 3cb17e1..af76c84 100644
--- a/parquet/src/column/writer.rs
+++ b/parquet/src/column/writer.rs
@@ -919,7 +919,7 @@ impl<T: DataType> ColumnWriterImpl<T> {
         };
         match self.descr.physical_type() {
             Type::INT32 => gen_stats_section!(i32, int32, min, max, distinct, 
nulls),
-            Type::BOOLEAN => gen_stats_section!(i32, int32, min, max, 
distinct, nulls),
+            Type::BOOLEAN => gen_stats_section!(bool, boolean, min, max, 
distinct, nulls),
             Type::INT64 => gen_stats_section!(i64, int64, min, max, distinct, 
nulls),
             Type::INT96 => gen_stats_section!(Int96, int96, min, max, 
distinct, nulls),
             Type::FLOAT => gen_stats_section!(f32, float, min, max, distinct, 
nulls),
@@ -1691,13 +1691,11 @@ mod tests {
     fn test_bool_statistics() {
         let stats = statistics_roundtrip::<BoolType>(&[true, false, false, 
true]);
         assert!(stats.has_min_max_set());
-        // should it be BooleanStatistics??
-        // https://github.com/apache/arrow-rs/issues/659
-        if let Statistics::Int32(stats) = stats {
-            assert_eq!(stats.min(), &0);
-            assert_eq!(stats.max(), &1);
+        if let Statistics::Boolean(stats) = stats {
+            assert_eq!(stats.min(), &false);
+            assert_eq!(stats.max(), &true);
         } else {
-            panic!("expecting Statistics::Int32, got {:?}", stats);
+            panic!("expecting Statistics::Boolean, got {:?}", stats);
         }
     }
 

Reply via email to