@@ -545,12 +545,12 @@ impl PyDataFrame {
545545 /// Convert to Arrow Table
546546 /// Collect the batches and pass to Arrow Table
547547 fn to_arrow_table ( & self , py : Python < ' _ > ) -> PyResult < PyObject > {
548- let batches = self . collect ( py) ?. to_object ( py) ;
549- let schema: PyObject = self . schema ( ) . into_pyobject ( py) ?. to_object ( py ) ;
548+ let batches = self . collect ( py) ?. into_pyobject ( py) ? ;
549+ let schema = self . schema ( ) . into_pyobject ( py) ?;
550550
551551 // Instantiate pyarrow Table object and use its from_batches method
552- let table_class = py. import_bound ( "pyarrow" ) ?. getattr ( "Table" ) ?;
553- let args = PyTuple :: new_bound ( py, & [ batches, schema] ) ;
552+ let table_class = py. import ( "pyarrow" ) ?. getattr ( "Table" ) ?;
553+ let args = PyTuple :: new ( py, & [ batches, schema] ) ? ;
554554 let table: PyObject = table_class. call_method1 ( "from_batches" , args) ?. into ( ) ;
555555 Ok ( table)
556556 }
@@ -585,8 +585,7 @@ impl PyDataFrame {
585585
586586 let ffi_stream = FFI_ArrowArrayStream :: new ( reader) ;
587587 let stream_capsule_name = CString :: new ( "arrow_array_stream" ) . unwrap ( ) ;
588- PyCapsule :: new_bound ( py, ffi_stream, Some ( stream_capsule_name) )
589- . map_err ( PyDataFusionError :: from)
588+ PyCapsule :: new ( py, ffi_stream, Some ( stream_capsule_name) ) . map_err ( PyDataFusionError :: from)
590589 }
591590
592591 fn execute_stream ( & self , py : Python ) -> PyDataFusionResult < PyRecordBatchStream > {
@@ -649,8 +648,8 @@ impl PyDataFrame {
649648 /// Collect the batches, pass to Arrow Table & then convert to polars DataFrame
650649 fn to_polars ( & self , py : Python < ' _ > ) -> PyResult < PyObject > {
651650 let table = self . to_arrow_table ( py) ?;
652- let dataframe = py. import_bound ( "polars" ) ?. getattr ( "DataFrame" ) ?;
653- let args = PyTuple :: new_bound ( py, & [ table] ) ;
651+ let dataframe = py. import ( "polars" ) ?. getattr ( "DataFrame" ) ?;
652+ let args = PyTuple :: new ( py, & [ table] ) ? ;
654653 let result: PyObject = dataframe. call1 ( args) ?. into ( ) ;
655654 Ok ( result)
656655 }
@@ -673,7 +672,7 @@ fn print_dataframe(py: Python, df: DataFrame) -> PyDataFusionResult<()> {
673672
674673 // Import the Python 'builtins' module to access the print function
675674 // Note that println! does not print to the Python debug console and is not visible in notebooks for instance
676- let print = py. import_bound ( "builtins" ) ?. getattr ( "print" ) ?;
675+ let print = py. import ( "builtins" ) ?. getattr ( "print" ) ?;
677676 print. call1 ( ( result, ) ) ?;
678677 Ok ( ( ) )
679678}
0 commit comments