Skip to content

Commit fb814cc

Browse files
committed
fix: improve error handling in PyDataFrame stream execution
1 parent 5336cf4 commit fb814cc

File tree

4 files changed

+544
-140
lines changed

4 files changed

+544
-140
lines changed

src/catalog.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,12 @@ impl PyDatabase {
9797
}
9898

9999
fn table(&self, name: &str, py: Python) -> PyDataFusionResult<PyTable> {
100-
let table_option = wait_for_future(py, self.database.table(name))
100+
// Clone the database to avoid borrowing self in the future
101+
let database = self.database.clone();
102+
// Clone the name to avoid borrowing it in the future
103+
let name_owned = name.to_string();
104+
105+
let table_option = wait_for_future(py, async move { database.table(&name_owned).await })
101106
.map_err(py_datafusion_err)?
102107
.map_err(PyDataFusionError::from)?;
103108
if let Some(table) = table_option {

0 commit comments

Comments
 (0)