@@ -756,7 +756,9 @@ impl PyDataFrame {
756756 let fut: JoinHandle < datafusion:: common:: Result < SendableRecordBatchStream > > =
757757 rt. spawn ( async move { df. execute_stream ( ) . await } ) ;
758758 let stream = wait_for_future ( py, fut) . map_err ( py_datafusion_err) ?;
759- Ok ( PyRecordBatchStream :: new ( stream?) )
759+ Ok ( PyRecordBatchStream :: new (
760+ stream. map_err ( PyDataFusionError :: from) ?,
761+ ) )
760762 }
761763
762764 fn execute_stream_partitioned ( & self , py : Python ) -> PyResult < Vec < PyRecordBatchStream > > {
@@ -817,7 +819,7 @@ impl PyDataFrame {
817819
818820 // Executes this DataFrame to get the total number of rows.
819821 fn count ( & self , py : Python ) -> PyDataFusionResult < usize > {
820- Ok ( wait_for_future ( py, self . df . as_ref ( ) . clone ( ) . count ( ) ) ?)
822+ Ok ( wait_for_future ( py, self . df . as_ref ( ) . clone ( ) . count ( ) ) ?? )
821823 }
822824
823825 /// Fill null values with a specified value for specific columns
@@ -844,11 +846,8 @@ impl PyDataFrame {
844846fn print_dataframe ( py : Python , df : DataFrame ) -> PyDataFusionResult < ( ) > {
845847 // Get string representation of record batches
846848 let batches = wait_for_future ( py, df. collect ( ) ) ?;
847- let batches_as_string = pretty:: pretty_format_batches ( & batches) ;
848- let result = match batches_as_string {
849- Ok ( batch) => format ! ( "DataFrame()\n {batch}" ) ,
850- Err ( err) => format ! ( "Error: {:?}" , err. to_string( ) ) ,
851- } ;
849+ let batches_as_string = pretty:: pretty_format_batches ( & batches) ?;
850+ let result = format ! ( "DataFrame()\n {batch}" , batch = batches_as_string) ;
852851
853852 // Import the Python 'builtins' module to access the print function
854853 // Note that println! does not print to the Python debug console and is not visible in notebooks for instance
0 commit comments