alamb commented on code in PR #27546:
URL: https://github.com/apache/datafusion/pull/27546#discussion_r4740140709


##########
datafusion/datasource-parquet/src/metadata.rs:
##########
@@ -1648,6 +1685,103 @@ mod tests {
             }
         }
 
+        #[test]
+        fn test_missing_null_counts_are_zero_by_writer() {
+            for (created_by, expected) in [
+                (Some("parquet-rs version 53.0.0"), true),
+                (Some("parquet-rs version 52.2.0"), true),
+                (Some("parquet-rs version 53.0.0-SNAPSHOT"), true),
+                (Some("parquet-rs version 53.1.0"), false),
+                (Some("parquet-rs version 54.0.0"), false),
+                (Some("datafusion version 42.0.0"), true),
+                (Some("datafusion version 42.1.0"), false),
+                (Some("datafusion version 56.0.0"), false),
+                (Some("parquet-mr version 1.13.1 (build abc)"), false),
+                (Some("parquet-cpp-arrow version 53.0.0"), false),
+                (Some("impala version 4.0.0"), false),
+                (Some("parquet-rs 53.0.0"), false),
+                (Some("parquet-rs version unknown"), false),
+                (Some("parquet-rs version 53"), false),
+                (Some("custom writer"), false),
+                (Some(""), false),
+                (None, false),
+            ] {
+                let file_metadata = FileMetaData::new(
+                    1,
+                    0,
+                    created_by.map(str::to_owned),
+                    None,
+                    create_schema_descr(1),
+                    None,
+                );
+                assert_eq!(
+                    missing_null_counts_are_zero(&file_metadata),
+                    expected,
+                    "created_by: {created_by:?}"
+                );
+            }
+        }
+
+        #[test]
+        fn test_statistics_missing_null_counts_for_legacy_writers() {

Review Comment:
   I don't think test is necessary -- a unit test for parsing various versions 
above is good, and hten I think we should have end to end tests (aka sql level) 
that verify all the plumbing is hooked up -- I don't think this intermediate 
test is needed



##########
datafusion/core/tests/parquet/dynamic_row_group_pruning.rs:
##########
@@ -98,12 +102,208 @@ fn file_with_missing_null_count(descending: bool, 
has_null: bool) -> NamedTempFi
         .unwrap();
     let mut output = TrackedWrite::new(file.as_file_mut());
     output.write_all(&bytes).unwrap();
-    ParquetMetaDataWriter::new_with_tracked(output, &metadata)
+    ParquetMetaDataWriter::new_with_tracked(output, metadata)
         .finish()
         .unwrap();
     file
 }
 
+fn file_without_zero_null_counts(created_by: &str) -> NamedTempFile {

Review Comment:
   I think these tests would be better if we made (very small) actual files 
using the affected versions and checked them in rather than try to 
programatically re-create them here
   
   So that would look like adding small checked in files, along with a README 
or something similar with the commands used to create them, and then using them 
in sqllogictests to verify the correct behavior



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to