berkaysynnada commented on code in PR #8895:
URL: https://github.com/apache/arrow-datafusion/pull/8895#discussion_r1457015913


##########
datafusion-cli/src/print_format.rs:
##########
@@ -161,23 +161,29 @@ impl PrintFormat {
         maxrows: MaxRows,
         with_header: bool,
     ) -> Result<()> {
-        if batches.is_empty() || batches[0].num_rows() == 0 {
+        // filter out any empty batches
+        let batches: Vec<_> = batches
+            .iter()
+            .filter(|b| b.num_rows() > 0)
+            .cloned()
+            .collect();
+        if batches.is_empty() {

Review Comment:
   I would also like to mention that a similar behavior exists for streaming 
results. If the first batch of the stream is empty, the header will not be 
printed, even if it was set to true (this issue existed prior to this PR). 
Perhaps we should print an empty record batch for the header before these 
checks if the flag is set.



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