comphead commented on code in PR #15029:
URL: https://github.com/apache/datafusion/pull/15029#discussion_r1982674514


##########
datafusion/datasource/src/memory.rs:
##########
@@ -425,25 +425,20 @@ impl DataSource for MemorySourceConfig {
                 }
             }
             DisplayFormatType::TreeRender => {
-                let partition_sizes: Vec<_> =
-                    self.partitions.iter().map(|b| b.len()).collect();
-                writeln!(f, "partition_sizes={:?}", partition_sizes)?;
-
-                if let Some(output_ordering) = self.sort_information.first() {
-                    writeln!(f, "output_ordering={}", output_ordering)?;
-                }
-
-                let eq_properties = self.eq_properties();
-                let constraints = eq_properties.constraints();
-                if !constraints.is_empty() {
-                    writeln!(f, "constraints={}", constraints)?;
-                }
-
-                if let Some(limit) = self.fetch {
-                    writeln!(f, "fetch={}", limit)?;
-                }
-
-                write!(f, "partitions={}", partition_sizes.len())
+                let total_rows = self.partitions.iter().map(|b| 
b.len()).sum::<usize>();
+                let total_bytes = self
+                    .partitions
+                    .iter()
+                    .map(|b| {
+                        b.iter()
+                            .map(|batch| batch.get_array_memory_size())
+                            .sum::<usize>()
+                    })
+                    .sum::<usize>();

Review Comment:
   ```suggestion
                   let total_bytes: usize = 
self.partitions.iter().flatten().map(|batch| 
batch.get_array_memory_size()).sum();
   ```
   
   This might be more effecient.



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to