andygrove commented on a change in pull request #942: URL: https://github.com/apache/arrow-datafusion/pull/942#discussion_r697431047
########## File path: python/src/dataframe.rs ########## @@ -139,6 +140,30 @@ impl DataFrame { to_py::to_py(&batches) } + /// Print the result, 20 lines by default + #[args(num = "20")] + fn show(&self, py: Python, num: usize) -> PyResult<()> { + let ctx = _ExecutionContext::from(self.ctx_state.clone()); + let plan = ctx + .optimize(&self.limit(num)?.plan) + .map_err(|e| -> errors::DataFusionError { e.into() })?; + let plan = ctx + .create_physical_plan(&plan) + .map_err(|e| -> errors::DataFusionError { e.into() })?; Review comment: You can chain these together to reduce the error handling code. ```suggestion let plan = ctx .optimize(&self.limit(num)?.plan) .and_then(|plan| ctx.create_physical_plan(&plan)) .map_err(|e| -> errors::DataFusionError { e.into() })?; ``` -- 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...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org