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



##########
File path: datafusion/src/physical_plan/file_format/parquet.rs
##########
@@ -435,6 +448,50 @@ fn build_row_group_predicate(
     )
 }
 
+fn read_partition_no_file_columns(
+    object_store: &dyn ObjectStore,
+    partition: &[PartitionedFile],
+    batch_size: usize,
+    response_tx: Sender<ArrowResult<RecordBatch>>,
+    limit: Option<usize>,
+    mut partition_column_projector: PartitionColumnProjector,
+) -> Result<()> {
+    use parquet::file::reader::FileReader;
+    let mut limit = limit.unwrap_or(usize::MAX);
+    for partitioned_file in partition {
+        let object_reader =
+            
object_store.file_reader(partitioned_file.file_meta.sized_file.clone())?;
+        let file_reader = 
SerializedFileReader::new(ChunkObjectReader(object_reader))?;
+        let mut file_rows: usize = file_reader
+            .metadata()
+            .file_metadata()
+            .num_rows()
+            .try_into()
+            .expect("Row count should always be greater than or equal to 0");
+        file_rows = limit.min(file_rows);
+        limit -= file_rows;
+        while file_rows >= batch_size {
+            send_result(
+                &response_tx,
+                partition_column_projector
+                    .project_empty(batch_size, 
&partitioned_file.partition_values),

Review comment:
       minor optimization, if it's sending the same recordbatch for a 
partition, we could create the record batch once at the beginning, then reuse 
it with `.clone()` for this loop and `.slide()` for the final send_result below.




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