Skip to content

Commit 9c84637

Browse files
committed
Update pyo3 interface
1 parent e87eb14 commit 9c84637

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

datafusion/common/src/pyarrow.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ impl PyArrowConvert for ScalarValue {
4343
let array = factory.call1((args, typ))?;
4444

4545
// convert the pyarrow array to rust array using C data interface
46-
let array = array.extract::<ArrayData>()?;
47-
let scalar = ScalarValue::try_from_array(&array.into(), 0)?;
46+
let array = arrow::array::make_array(ArrayData::from_pyarrow(array)?);
47+
let scalar = ScalarValue::try_from_array(&array, 0)?;
4848

4949
Ok(scalar)
5050
}
5151

5252
fn to_pyarrow(&self, py: Python) -> PyResult<PyObject> {
5353
let array = self.to_array();
5454
// convert to pyarrow array using C data interface
55-
let pyarray = array.data_ref().clone().into_py(py);
55+
let pyarray = array.data().to_pyarrow(py)?;
5656
let pyscalar = pyarray.call_method1(py, "__getitem__", (0,))?;
5757

5858
Ok(pyscalar)

0 commit comments

Comments
 (0)