Skip to content

Commit

Permalink
validate no-default-features on ci for pyo3-arrow (#232)
Browse files Browse the repository at this point in the history
* validate no-default-features on ci for pyo3-arrow

* fix no-default-features
  • Loading branch information
kylebarron authored Oct 14, 2024
1 parent 523585b commit 692e40b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,19 @@ jobs:
run: |
cargo test --all
cargo test --all --all-features
check-features:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
args:
- "-p pyo3-arrow --no-default-features"
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Test
run: cargo check ${{ matrix.args }}
10 changes: 6 additions & 4 deletions pyo3-arrow/src/array.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::fmt::Display;
use std::sync::Arc;

use arrow::array::AsArray;
use arrow::compute::concat;
use arrow::datatypes::{
Float32Type, Float64Type, Int16Type, Int32Type, Int64Type, Int8Type, UInt16Type, UInt32Type,
Expand All @@ -28,7 +27,7 @@ use crate::input::AnyArray;
use crate::interop::numpy::from_numpy::from_numpy;
use crate::interop::numpy::to_numpy::to_numpy;
use crate::scalar::PyScalar;
use crate::{PyArrowBuffer, PyDataType, PyField};
use crate::{PyDataType, PyField};

/// A Python-facing Arrow array.
///
Expand Down Expand Up @@ -224,13 +223,16 @@ impl PyArray {
Ok(Self::new(array, field))
}

fn buffer(&self) -> PyArrowBuffer {
#[cfg(feature = "buffer_protocol")]
fn buffer(&self) -> crate::PyArrowBuffer {
use arrow::array::AsArray;

match self.array.data_type() {
DataType::Int64 => {
let arr = self.array.as_primitive::<Int64Type>();
let values = arr.values();
let buffer = values.inner().clone();
PyArrowBuffer {
crate::PyArrowBuffer {
inner: Some(buffer),
}
}
Expand Down

0 comments on commit 692e40b

Please sign in to comment.