You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2021/08/10 21:10:53 UTC

[arrow-rs] 01/01: Write boolean stats for boolean columns (not i32 stats) (#661)

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

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

commit cdb48d3525c7c77d460bd950ebbf2c097300dd34
Author: Andrew Lamb <an...@nerdnetworks.org>
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);
         }
     }