Skip to content

Commit ec2abf1

Browse files
committed
fix: handle error from wait_for_future in PyDataFrame collect method
1 parent 6f0ef29 commit ec2abf1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/dataframe.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,12 @@ impl PyDataFrame {
393393
/// Unless some order is specified in the plan, there is no
394394
/// guarantee of the order of the result.
395395
fn collect(&self, py: Python) -> PyResult<Vec<PyObject>> {
396-
let batches = wait_for_future(py, self.df.as_ref().clone().collect())
396+
let batches = wait_for_future(py, self.df.as_ref().clone().collect())?
397397
.map_err(PyDataFusionError::from)?;
398+
398399
// cannot use PyResult<Vec<RecordBatch>> return type due to
399400
// https://github.com/PyO3/pyo3/issues/1813
400-
let result = batches.into_iter().map(|rb| rb.to_pyarrow(py)).collect();
401-
result
401+
batches.into_iter().map(|rb| rb.to_pyarrow(py)).collect()
402402
}
403403

404404
/// Cache DataFrame.

0 commit comments

Comments
 (0)