Skip to content

Commit 9de354b

Browse files
committed
Update for breaking changes in apache/arrow-rs#2711
1 parent 81b5794 commit 9de354b

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,10 @@ exclude = ["datafusion-cli"]
3434
[profile.release]
3535
codegen-units = 1
3636
lto = true
37+
38+
[patch.crates-io]
39+
arrow = { git = "https://github.com/tustvold/arrow-rs.git", rev = "6f62bb62f630cbd910ae5b1b04f97688af7c1b42" }
40+
parquet = { git = "https://github.com/tustvold/arrow-rs.git", rev = "6f62bb62f630cbd910ae5b1b04f97688af7c1b42" }
41+
arrow-buffer = { git = "https://github.com/tustvold/arrow-rs.git", rev = "6f62bb62f630cbd910ae5b1b04f97688af7c1b42" }
42+
arrow-schema = { git = "https://github.com/tustvold/arrow-rs.git", rev = "6f62bb62f630cbd910ae5b1b04f97688af7c1b42" }
43+
arrow-flight = { git = "https://github.com/tustvold/arrow-rs.git", rev = "6f62bb62f630cbd910ae5b1b04f97688af7c1b42" }

datafusion/common/src/pyarrow.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
2020
use crate::{DataFusionError, ScalarValue};
2121
use arrow::array::ArrayData;
22-
use arrow::pyarrow::PyArrowConvert;
22+
use arrow::pyarrow::{PyArrowConvert, PyArrowType};
2323
use pyo3::exceptions::PyException;
2424
use pyo3::prelude::PyErr;
2525
use pyo3::types::PyList;
@@ -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 = array.extract::<PyArrowType<ArrayData>>()?;
47+
let scalar = ScalarValue::try_from_array(&array.0.into(), 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 = PyArrowType(array.data_ref().clone()).into_py(py);
5656
let pyscalar = pyarray.call_method1(py, "__getitem__", (0,))?;
5757

5858
Ok(pyscalar)

0 commit comments

Comments
 (0)