Dandandan commented on a change in pull request #2000:
URL: https://github.com/apache/arrow-datafusion/pull/2000#discussion_r833691608



##########
File path: datafusion/src/physical_plan/file_format/mod.rs
##########
@@ -293,6 +293,34 @@ impl PartitionColumnProjector {
         }
     }
 
+    // Creates a RecordBatch with values from the partition_values. Used when 
no non-partition values are read
+    fn project_empty(
+        &mut self,
+        batch_size: usize,
+        partition_values: &[ScalarValue],
+    ) -> ArrowResult<RecordBatch> {
+        let expected_cols = self.projected_schema.fields().len();
+        if expected_cols != self.projected_partition_indexes.len() {
+            return Err(ArrowError::SchemaError(format!(
+                "Unexepected number of partition values, expected {} but got 
{}",
+                expected_cols,
+                partition_values.len()
+            )));
+        }
+        let mut cols = Vec::with_capacity(partition_values.len());

Review comment:
       Small style suggestion: I think we can rewrite this to use `.collect()` 
on an iterator.




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