kosiew opened a new pull request, #1208: URL: https://github.com/apache/datafusion-python/pull/1208
## Which issue does this PR close? * Closes #1207 ## Rationale for this change When calling `show()` on a DataFrame with no rows, the current output may be misleading or unclear. This PR enhances the user experience by providing a clear message indicating that the DataFrame has no rows. This makes debugging and usage more intuitive, especially in cases where filters or queries return empty results. ## What changes are included in this PR? * Added a conditional check in `print_dataframe` to handle the case where `DataFrame.collect()` returns no batches. * If the DataFrame has no rows, output "DataFrame has no rows". * Added tests for various scenarios: * Showing an empty DataFrame after filtering. * Showing the result of a `SELECT` query that returns no rows. * Showing an empty record batch with defined schema. ## Are these changes tested? Yes, comprehensive tests have been added using `capsys` to verify the `show()` output under multiple empty DataFrame scenarios: * `test_show_empty` * `test_show_select_where_no_rows` * `test_show_from_empty_batch` ## Are there any user-facing changes? Yes: * When `show()` is called on an empty DataFrame, the output is now: `DataFrame has no rows` * This is a user-friendly message replacing a potentially confusing blank or improperly formatted output. <!-- If there are any breaking changes to public APIs, please add the `api change` label. --> -- 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