konjac commented on code in PR #1015: URL: https://github.com/apache/datafusion-python/pull/1015#discussion_r1959678559
########## src/dataframe.rs: ########## @@ -90,8 +91,16 @@ impl PyDataFrame { } fn __repr__(&self, py: Python) -> PyDataFusionResult<String> { - let df = self.df.as_ref().clone().limit(0, Some(10))?; - let batches = wait_for_future(py, df.collect())?; + let df = self.df.as_ref().clone(); + + let stream = wait_for_future(py, df.execute_stream()).map_err(py_datafusion_err)?; + + let batches: Vec<RecordBatch> = wait_for_future( + py, + stream.take(10).collect::<Vec<_>>()) + .into_iter() + .collect::<Result<Vec<_>,_>>()?; + Review Comment: @timsaucer I think enhancement could be a separate issue #1026 -- 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