QuakeWang commented on code in PR #208:
URL: https://github.com/apache/paimon-rust/pull/208#discussion_r3036922780


##########
crates/integrations/datafusion/src/physical_plan/scan.rs:
##########
@@ -226,4 +277,156 @@ mod tests {
             table_schema,
         )
     }
+
+    fn write_int_parquet_file(
+        path: &std::path::Path,
+        columns: Vec<(&str, Vec<i32>)>,
+        max_row_group_size: Option<usize>,
+    ) {
+        let schema = Arc::new(ArrowSchema::new(
+            columns
+                .iter()
+                .map(|(name, _)| Field::new(*name, ArrowDataType::Int32, 
false))
+                .collect::<Vec<_>>(),
+        ));
+        let arrays: Vec<Arc<dyn datafusion::arrow::array::Array>> = columns
+            .iter()
+            .map(|(_, values)| {
+                Arc::new(Int32Array::from(values.clone()))
+                    as Arc<dyn datafusion::arrow::array::Array>
+            })
+            .collect();
+        let batch =
+            
datafusion::arrow::record_batch::RecordBatch::try_new(schema.clone(), 
arrays).unwrap();
+
+        let props = max_row_group_size.map(|size| {
+            WriterProperties::builder()
+                .set_max_row_group_size(size)
+                .build()
+        });
+        let file = File::create(path).unwrap();
+        let mut writer = ArrowWriter::try_new(file, schema, props).unwrap();
+        writer.write(&batch).unwrap();
+        writer.close().unwrap();
+    }
+
+    fn local_file_path(path: &std::path::Path) -> String {
+        let normalized = path.to_string_lossy().replace('\\', "/");
+        if normalized.starts_with('/') {
+            format!("file:{normalized}")
+        } else {
+            format!("file:/{normalized}")
+        }
+    }
+
+    fn test_data_file(file_name: &str, row_count: i64) -> DataFileMeta {

Review Comment:
   Fixed. I extracted the shared parquet read test fixtures into a common test 
utility and removed the duplicated test_data_file helper.



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