Skip to content

Commit

Permalink
migrate substrait.rs to Bound api
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-J-Ward committed Jun 17, 2024
1 parent 67e4dac commit 9961848
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/substrait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl PyPlan {
self.plan
.encode(&mut proto_bytes)
.map_err(DataFusionError::EncodeError)?;
Ok(PyBytes::new(py, &proto_bytes).into())
Ok(PyBytes::new_bound(py, &proto_bytes).unbind().into())
}
}

Expand Down Expand Up @@ -76,7 +76,7 @@ impl PySubstraitSerializer {
pub fn serialize_to_plan(sql: &str, ctx: PySessionContext, py: Python) -> PyResult<PyPlan> {
match PySubstraitSerializer::serialize_bytes(sql, ctx, py) {
Ok(proto_bytes) => {
let proto_bytes: &PyBytes = proto_bytes.as_ref(py).downcast().unwrap();
let proto_bytes = proto_bytes.bind(py).downcast::<PyBytes>().unwrap();
PySubstraitSerializer::deserialize_bytes(proto_bytes.as_bytes().to_vec(), py)
}
Err(e) => Err(py_datafusion_err(e)),
Expand All @@ -87,7 +87,7 @@ impl PySubstraitSerializer {
pub fn serialize_bytes(sql: &str, ctx: PySessionContext, py: Python) -> PyResult<PyObject> {
let proto_bytes: Vec<u8> = wait_for_future(py, serializer::serialize_bytes(sql, &ctx.ctx))
.map_err(DataFusionError::from)?;
Ok(PyBytes::new(py, &proto_bytes).into())
Ok(PyBytes::new_bound(py, &proto_bytes).unbind().into())
}

#[staticmethod]
Expand Down

0 comments on commit 9961848

Please sign in to comment.