From 9de354bf45c0cc4121af04ea8138df7fddab76ed Mon Sep 17 00:00:00 2001 From: Raphael Taylor-Davies Date: Tue, 20 Sep 2022 18:24:17 +0100 Subject: [PATCH] Update for breaking changes in https://github.com/apache/arrow-rs/pull/2711 --- Cargo.toml | 7 +++++++ datafusion/common/src/pyarrow.rs | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ab3f427e49b..3d8479361da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,3 +34,10 @@ exclude = ["datafusion-cli"] [profile.release] codegen-units = 1 lto = true + +[patch.crates-io] +arrow = { git = "https://github.com/tustvold/arrow-rs.git", rev = "6f62bb62f630cbd910ae5b1b04f97688af7c1b42" } +parquet = { git = "https://github.com/tustvold/arrow-rs.git", rev = "6f62bb62f630cbd910ae5b1b04f97688af7c1b42" } +arrow-buffer = { git = "https://github.com/tustvold/arrow-rs.git", rev = "6f62bb62f630cbd910ae5b1b04f97688af7c1b42" } +arrow-schema = { git = "https://github.com/tustvold/arrow-rs.git", rev = "6f62bb62f630cbd910ae5b1b04f97688af7c1b42" } +arrow-flight = { git = "https://github.com/tustvold/arrow-rs.git", rev = "6f62bb62f630cbd910ae5b1b04f97688af7c1b42" } diff --git a/datafusion/common/src/pyarrow.rs b/datafusion/common/src/pyarrow.rs index bb3d9a6d7ba..3c9001eac9c 100644 --- a/datafusion/common/src/pyarrow.rs +++ b/datafusion/common/src/pyarrow.rs @@ -19,7 +19,7 @@ use crate::{DataFusionError, ScalarValue}; use arrow::array::ArrayData; -use arrow::pyarrow::PyArrowConvert; +use arrow::pyarrow::{PyArrowConvert, PyArrowType}; use pyo3::exceptions::PyException; use pyo3::prelude::PyErr; use pyo3::types::PyList; @@ -43,8 +43,8 @@ impl PyArrowConvert for ScalarValue { let array = factory.call1((args, typ))?; // convert the pyarrow array to rust array using C data interface - let array = array.extract::()?; - let scalar = ScalarValue::try_from_array(&array.into(), 0)?; + let array = array.extract::>()?; + let scalar = ScalarValue::try_from_array(&array.0.into(), 0)?; Ok(scalar) } @@ -52,7 +52,7 @@ impl PyArrowConvert for ScalarValue { fn to_pyarrow(&self, py: Python) -> PyResult { let array = self.to_array(); // convert to pyarrow array using C data interface - let pyarray = array.data_ref().clone().into_py(py); + let pyarray = PyArrowType(array.data_ref().clone()).into_py(py); let pyscalar = pyarray.call_method1(py, "__getitem__", (0,))?; Ok(pyscalar)