Skip to content

Commit

Permalink
Merge branch 'apache:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
comphead authored Dec 12, 2023
2 parents d1dcf16 + 802ed42 commit 7c00543
Show file tree
Hide file tree
Showing 38 changed files with 804 additions and 1,416 deletions.
50 changes: 13 additions & 37 deletions .github/workflows/arrow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ jobs:
run: cargo test -p arrow-data --all-features
- name: Test arrow-schema with all features
run: cargo test -p arrow-schema --all-features
- name: Test arrow-array with all features except SIMD
run: cargo test -p arrow-array
- name: Test arrow-array with all features
run: cargo test -p arrow-array --all-features
- name: Test arrow-select with all features
run: cargo test -p arrow-select --all-features
- name: Test arrow-cast with all features
Expand All @@ -85,15 +85,15 @@ jobs:
run: cargo test -p arrow-string --all-features
- name: Test arrow-ord with all features
run: cargo test -p arrow-ord --all-features
- name: Test arrow-arith with all features except SIMD
run: cargo test -p arrow-arith
- name: Test arrow-arith with all features
run: cargo test -p arrow-arith --all-features
- name: Test arrow-row with all features
run: cargo test -p arrow-row --all-features
- name: Test arrow-integration-test with all features
run: cargo test -p arrow-integration-test --all-features
- name: Test arrow with default features
run: cargo test -p arrow
- name: Test arrow with all features apart from simd
- name: Test arrow with all features except pyarrow
run: cargo test -p arrow --features=force_validate,prettyprint,ipc_compression,ffi,chrono-tz
- name: Run examples
run: |
Expand Down Expand Up @@ -132,29 +132,6 @@ jobs:
- name: Check compilation --no-default-features --all-targets --features chrono-tz
run: cargo check -p arrow --no-default-features --all-targets --features chrono-tz

# test the --features "simd" of the arrow crate. This requires nightly Rust.
linux-test-simd:
name: Test SIMD on AMD64 Rust ${{ matrix.rust }}
runs-on: ubuntu-latest
container:
image: amd64/rust
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Rust toolchain
uses: ./.github/actions/setup-builder
with:
rust-version: nightly
- name: Test arrow-array with SIMD
run: cargo test -p arrow-array --features simd
- name: Test arrow-arith with SIMD
run: cargo test -p arrow-arith --features simd
- name: Test arrow with SIMD
run: cargo test -p arrow --features simd
- name: Check compilation --features simd --all-targets
run: cargo check -p arrow --features simd --all-targets


# test the arrow crate builds against wasm32 in nightly rust
wasm32-build:
Expand All @@ -169,12 +146,11 @@ jobs:
- name: Setup Rust toolchain
uses: ./.github/actions/setup-builder
with:
rust-version: nightly
target: wasm32-unknown-unknown,wasm32-wasi
- name: Build wasm32-unknown-unknown
run: cargo build -p arrow --no-default-features --features=json,csv,ipc,simd,ffi --target wasm32-unknown-unknown
run: cargo build -p arrow --no-default-features --features=json,csv,ipc,ffi --target wasm32-unknown-unknown
- name: Build wasm32-wasi
run: cargo build -p arrow --no-default-features --features=json,csv,ipc,simd,ffi --target wasm32-wasi
run: cargo build -p arrow --no-default-features --features=json,csv,ipc,ffi --target wasm32-wasi

clippy:
name: Clippy
Expand All @@ -193,8 +169,8 @@ jobs:
run: cargo clippy -p arrow-data --all-targets --all-features -- -D warnings
- name: Clippy arrow-schema with all features
run: cargo clippy -p arrow-schema --all-targets --all-features -- -D warnings
- name: Clippy arrow-array with all features except SIMD
run: cargo clippy -p arrow-array --all-targets -- -D warnings
- name: Clippy arrow-array with all features
run: cargo clippy -p arrow-array --all-targets --all-features -- -D warnings
- name: Clippy arrow-select with all features
run: cargo clippy -p arrow-select --all-targets --all-features -- -D warnings
- name: Clippy arrow-cast with all features
Expand All @@ -211,12 +187,12 @@ jobs:
run: cargo clippy -p arrow-string --all-targets --all-features -- -D warnings
- name: Clippy arrow-ord with all features
run: cargo clippy -p arrow-ord --all-targets --all-features -- -D warnings
- name: Clippy arrow-arith with all features except SIMD
run: cargo clippy -p arrow-arith --all-targets -- -D warnings
- name: Clippy arrow-arith with all features
run: cargo clippy -p arrow-arith --all-targets --all-features -- -D warnings
- name: Clippy arrow-row with all features
run: cargo clippy -p arrow-row --all-targets --all-features -- -D warnings
- name: Clippy arrow with all features except SIMD
run: cargo clippy -p arrow --features=prettyprint,csv,ipc,test_utils,ffi,ipc_compression,chrono-tz --all-targets -- -D warnings
- name: Clippy arrow with all features
run: cargo clippy -p arrow --all-features --all-targets -- -D warnings
- name: Clippy arrow-integration-test with all features
run: cargo clippy -p arrow-integration-test --all-targets --all-features -- -D warnings
- name: Clippy arrow-integration-testing with all features
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/miri.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ cargo miri test -p arrow-buffer
cargo miri test -p arrow-data --features ffi
cargo miri test -p arrow-schema --features ffi
cargo miri test -p arrow-array
cargo miri test -p arrow-arith --features simd
cargo miri test -p arrow-arith
cargo miri test -p arrow-ord
3 changes: 0 additions & 3 deletions arrow-arith/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,3 @@ half = { version = "2.1", default-features = false }
num = { version = "0.4", default-features = false, features = ["std"] }

[dev-dependencies]

[features]
simd = ["arrow-array/simd"]
4 changes: 0 additions & 4 deletions arrow-array/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ chrono-tz = { version = "0.8", optional = true }
num = { version = "0.4.1", default-features = false, features = ["std"] }
half = { version = "2.1", default-features = false, features = ["num-traits"] }
hashbrown = { version = "0.14", default-features = false }
packed_simd = { version = "0.3.9", default-features = false, optional = true }

[features]
simd = ["packed_simd"]

[dev-dependencies]
rand = { version = "0.8", default-features = false, features = ["std", "std_rng"] }
Expand Down
22 changes: 22 additions & 0 deletions arrow-array/src/array/boolean_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ impl BooleanArray {
});
Self::new(values, nulls)
}

/// Deconstruct this array into its constituent parts
pub fn into_parts(self) -> (BooleanBuffer, Option<NullBuffer>) {
(self.values, self.nulls)
}
}

impl Array for BooleanArray {
Expand Down Expand Up @@ -618,4 +623,21 @@ mod tests {
assert_eq!(b.false_count(), expected_false);
}
}

#[test]
fn test_into_parts() {
let boolean_array = [Some(true), None, Some(false)]
.into_iter()
.collect::<BooleanArray>();
let (values, nulls) = boolean_array.into_parts();
assert_eq!(values.values(), &[0b0000_0001]);
assert!(nulls.is_some());
assert_eq!(nulls.unwrap().buffer().as_slice(), &[0b0000_0101]);

let boolean_array =
BooleanArray::from(vec![false, false, false, false, false, false, false, true]);
let (values, nulls) = boolean_array.into_parts();
assert_eq!(values.values(), &[0b1000_0000]);
assert!(nulls.is_none());
}
}
8 changes: 7 additions & 1 deletion arrow-array/src/array/primitive_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,18 @@ pub type Time64MicrosecondArray = PrimitiveArray<Time64MicrosecondType>;
pub type Time64NanosecondArray = PrimitiveArray<Time64NanosecondType>;

/// A [`PrimitiveArray`] of “calendar” intervals in months
///
/// See [`IntervalYearMonthType`] for details on representation and caveats.
pub type IntervalYearMonthArray = PrimitiveArray<IntervalYearMonthType>;

/// A [`PrimitiveArray`] of “calendar” intervals in days and milliseconds
///
/// See [`IntervalDayTimeType`] for details on representation and caveats.
pub type IntervalDayTimeArray = PrimitiveArray<IntervalDayTimeType>;

/// A [`PrimitiveArray`] of “calendar” intervals in months, days, and nanoseconds
/// A [`PrimitiveArray`] of “calendar” intervals in months, days, and nanoseconds.
///
/// See [`IntervalMonthDayNanoType`] for details on representation and caveats.
pub type IntervalMonthDayNanoArray = PrimitiveArray<IntervalMonthDayNanoType>;

/// A [`PrimitiveArray`] of elapsed durations in seconds
Expand Down
Loading

0 comments on commit 7c00543

Please sign in to comment.