Skip to content

Commit 1a848e5

Browse files
authored
Upgrade to arrow 54 and datafusion 45 (#2271)
including the pyo3 version bump (#2270 and #2042)
1 parent d5ab2c0 commit 1a848e5

File tree

24 files changed

+294
-233
lines changed

24 files changed

+294
-233
lines changed

Cargo.lock

Lines changed: 130 additions & 105 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ categories = ["database-implementations", "data-structures", "compression"]
5252
anyhow = "1.0.95"
5353
arbitrary = "1.3.2"
5454
arrayref = "0.3.7"
55-
arrow = "53.3"
56-
arrow-arith = "53.3"
57-
arrow-array = "53.3"
58-
arrow-buffer = "53.3"
59-
arrow-cast = "53.3"
60-
arrow-ord = "53.3"
61-
arrow-schema = "53.3"
62-
arrow-select = "53.3"
63-
arrow-string = "53.3"
55+
arrow = "54.1"
56+
arrow-arith = "54.1"
57+
arrow-array = "54.1"
58+
arrow-buffer = "54.1"
59+
arrow-cast = "54.1"
60+
arrow-ord = "54.1"
61+
arrow-schema = "54.1"
62+
arrow-select = "54.1"
63+
arrow-string = "54.1"
6464
async-once-cell = "0.5.4"
6565
async-trait = "0.1.86"
6666
pkg-config = "0.3.31"
@@ -76,12 +76,12 @@ criterion = { package = "codspeed-criterion-compat", features = [
7676
], version = "2.7.2" }
7777
croaring = "2.1.0"
7878
crossterm = "0.28"
79-
datafusion = { version = "44.0.0", default-features = false }
80-
datafusion-common = "44"
81-
datafusion-execution = "44"
82-
datafusion-expr = "44"
83-
datafusion-physical-expr = "44"
84-
datafusion-physical-plan = "44"
79+
datafusion = { version = "45", default-features = false }
80+
datafusion-common = "45"
81+
datafusion-execution = "45"
82+
datafusion-expr = "45"
83+
datafusion-physical-expr = "45"
84+
datafusion-physical-plan = "45"
8585
divan = "0.1.14"
8686
dyn-hash = "0.2.0"
8787
enum-iterator = "2.0.0"
@@ -111,15 +111,15 @@ num-traits = "0.2.19"
111111
num_enum = "0.7.2"
112112
object_store = "0.11.0"
113113
oneshot = "0.1.10"
114-
parquet = "53.3"
114+
parquet = "54.1"
115115
paste = "1.0.15"
116116
pin-project = "1.1.5"
117117
pin-project-lite = "0.2.15"
118118
prost = "0.13.4"
119119
prost-build = "0.13.4"
120120
prost-types = "0.13.4"
121-
pyo3 = { version = ">= 0.22", features = ["extension-module", "abi3-py310"] }
122-
pyo3-log = ">= 0.11"
121+
pyo3 = { version = "0.23.4", features = ["extension-module", "abi3-py310"] }
122+
pyo3-log = "0.12.1"
123123
rancor = "0.1.0"
124124
rand = "0.8.5"
125125
rand_distr = "0.4"
@@ -154,7 +154,7 @@ tikv-jemallocator = "0.6"
154154
thiserror = "2.0.3"
155155
tokio = "1.36"
156156
tracing = "0.1.37"
157-
url = "2.4"
157+
url = "2.5.4"
158158
uuid = "1.8.0"
159159
wasm-bindgen-futures = "0.4.39"
160160

pyvortex/src/arrays/from_arrow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::arrays::PyArray;
1515

1616
/// Convert an Arrow object to a Vortex array.
1717
pub(super) fn from_arrow<'py>(obj: &Bound<'py, PyAny>) -> PyResult<Bound<'py, PyArray>> {
18-
let pa = obj.py().import_bound("pyarrow")?;
18+
let pa = obj.py().import("pyarrow")?;
1919
let pa_array = pa.getattr("Array")?;
2020
let chunked_array = pa.getattr("ChunkedArray")?;
2121
let table = pa.getattr("Table")?;

pyvortex/src/arrays/mod.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use arrow::array::{Array as ArrowArray, ArrayRef};
77
use arrow::pyarrow::ToPyArrow;
88
use pyo3::exceptions::PyValueError;
99
use pyo3::prelude::*;
10-
use pyo3::types::{IntoPyDict, PyList};
10+
use pyo3::types::{PyDict, PyList};
1111
use pyo3::PyClass;
1212
use vortex::array::ChunkedArray;
1313
use vortex::arrow::{infer_data_type, IntoArrowArray};
@@ -29,7 +29,7 @@ use crate::python_repr::PythonRepr;
2929
use crate::scalar::PyScalar;
3030

3131
pub(crate) fn init(py: Python, parent: &Bound<PyModule>) -> PyResult<()> {
32-
let m = PyModule::new_bound(py, "arrays")?;
32+
let m = PyModule::new(py, "arrays")?;
3333
parent.add_submodule(&m)?;
3434
install_module("vortex._lib.arrays", &m)?;
3535

@@ -250,24 +250,28 @@ impl PyArray {
250250
// the preferred type of each chunk may be different.
251251
let arrow_dtype = infer_data_type(chunked_array.dtype())?;
252252

253-
let chunks: Vec<ArrayRef> = chunked_array
253+
let chunks = chunked_array
254254
.chunks()
255-
.map(|chunk| -> PyResult<ArrayRef> { Ok(chunk.into_arrow(&arrow_dtype)?) })
255+
.map(|chunk| PyResult::Ok(chunk.into_arrow(&arrow_dtype)?))
256256
.collect::<PyResult<Vec<ArrayRef>>>()?;
257257
if chunks.is_empty() {
258258
return Err(PyValueError::new_err("No chunks in array"));
259259
}
260+
260261
let pa_data_type = chunks[0].data_type().clone().to_pyarrow(py)?;
261-
let chunks: PyResult<Vec<PyObject>> = chunks
262+
let chunks = chunks
262263
.iter()
263264
.map(|arrow_array| arrow_array.into_data().to_pyarrow(py))
264-
.collect();
265+
.collect::<Result<Vec<_>, _>>()?;
266+
267+
let kwargs =
268+
PyDict::from_sequence(&PyList::new(py, vec![("type", pa_data_type)])?.into_any())?;
265269

266270
// Combine into a chunked array
267-
PyModule::import_bound(py, "pyarrow")?.call_method(
271+
PyModule::import(py, "pyarrow")?.call_method(
268272
"chunked_array",
269-
(PyList::new_bound(py, chunks?),),
270-
Some(&[("type", pa_data_type)].into_py_dict_bound(py)),
273+
(PyList::new(py, chunks)?,),
274+
Some(&kwargs),
271275
)
272276
} else {
273277
Ok(vortex

pyvortex/src/compress.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::arrays::PyArray;
55
use crate::install_module;
66

77
pub(crate) fn init(py: Python, parent: &Bound<PyModule>) -> PyResult<()> {
8-
let m = PyModule::new_bound(py, "compress")?;
8+
let m = PyModule::new(py, "compress")?;
99
parent.add_submodule(&m)?;
1010
install_module("vortex._lib.compress", &m)?;
1111

pyvortex/src/dataset.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use crate::record_batch_reader::VortexRecordBatchReader;
2424
use crate::{install_module, TOKIO_RUNTIME};
2525

2626
pub(crate) fn init(py: Python, parent: &Bound<PyModule>) -> PyResult<()> {
27-
let m = PyModule::new_bound(py, "dataset")?;
27+
let m = PyModule::new(py, "dataset")?;
2828
parent.add_submodule(&m)?;
2929
install_module("vortex._lib.dataset", &m)?;
3030

pyvortex/src/dtype/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use crate::python_repr::PythonRepr;
3434

3535
/// Register DType functions and classes.
3636
pub(crate) fn init(py: Python, parent: &Bound<PyModule>) -> PyResult<()> {
37-
let m = PyModule::new_bound(py, "dtype")?;
37+
let m = PyModule::new(py, "dtype")?;
3838
parent.add_submodule(&m)?;
3939
install_module("vortex._lib.dtype", &m)?;
4040

pyvortex/src/encoding/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use fastlanes::{PyFastLanesBitPackedEncoding, PyFastLanesDeltaEncoding, PyFastLa
1818
use crate::install_module;
1919

2020
pub(crate) fn init(py: Python, parent: &Bound<PyModule>) -> PyResult<()> {
21-
let m = PyModule::new_bound(py, "encoding")?;
21+
let m = PyModule::new(py, "encoding")?;
2222
parent.add_submodule(&m)?;
2323
install_module("vortex._lib.encoding", &m)?;
2424

pyvortex/src/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::install_module;
99
use crate::scalar::factory::scalar_helper;
1010

1111
pub(crate) fn init(py: Python, parent: &Bound<PyModule>) -> PyResult<()> {
12-
let m = PyModule::new_bound(py, "expr")?;
12+
let m = PyModule::new(py, "expr")?;
1313
parent.add_submodule(&m)?;
1414
install_module("vortex._lib.expr", &m)?;
1515

@@ -159,7 +159,7 @@ fn coerce_expr<'py>(value: &Bound<'py, PyAny>) -> PyResult<Bound<'py, PyExpr>> {
159159
Ok(value.clone())
160160
} else if let Ok(value) = value.downcast::<PyNone>() {
161161
scalar(DType::Null, value)
162-
} else if let Ok(value) = value.downcast::<PyLong>() {
162+
} else if let Ok(value) = value.downcast::<PyInt>() {
163163
scalar(DType::Primitive(PType::I64, nonnull), value)
164164
} else if let Ok(value) = value.downcast::<PyFloat>() {
165165
scalar(DType::Primitive(PType::F64, nonnull), value)

pyvortex/src/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::expr::PyExpr;
1414
use crate::{install_module, TOKIO_RUNTIME};
1515

1616
pub(crate) fn init(py: Python, parent: &Bound<PyModule>) -> PyResult<()> {
17-
let m = PyModule::new_bound(py, "io")?;
17+
let m = PyModule::new(py, "io")?;
1818
parent.add_submodule(&m)?;
1919
install_module("vortex._lib.io", &m)?;
2020

0 commit comments

Comments
 (0)