Skip to content

Commit

Permalink
turn it up to 11
Browse files Browse the repository at this point in the history
  • Loading branch information
a10y committed Dec 19, 2024
1 parent 11761b5 commit 34be58d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/bench-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ jobs:
BENCH_VORTEX_RATIOS: '.*'
RUSTFLAGS: '-C target-cpu=native'
HOME: /home/ci-runner
RUST_BACKTRACE: full
run: |
cargo run --bin clickbench --release -- -d gh-json | tee clickbench.json
- name: Setup AWS CLI
Expand Down
2 changes: 1 addition & 1 deletion bench-vortex/src/bin/clickbench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ fn main() {
let start = Instant::now();
execute_query(&context, &query)
.await
.expect(&format!("executing query {query_idx}"));
.unwrap_or_else(|e| panic!("executing query {query_idx}: {e}"));
start.elapsed()
});

Expand Down
2 changes: 1 addition & 1 deletion encodings/fastlanes/src/bitpacking/compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ pub fn unpack(array: BitPackedArray) -> VortexResult<PrimitiveArray> {
let length = array.len();
let offset = array.offset() as usize;
let ptype = array.ptype();
let mut unpacked = match_each_unsigned_integer_ptype!(array.ptype().to_unsigned(), |$P| {
let mut unpacked = match_each_unsigned_integer_ptype!(ptype.to_unsigned(), |$P| {
PrimitiveArray::from_vec(
unpack_primitive::<$P>(array.packed_slice::<$P>(), bit_width, offset, length),
array.validity(),
Expand Down
7 changes: 5 additions & 2 deletions encodings/fastlanes/src/bitpacking/compute/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use fastlanes::BitPacking;
use vortex_array::array::PrimitiveArray;
use vortex_array::compute::{filter, FilterFn, FilterIter, FilterMask};
use vortex_array::variants::PrimitiveArrayTrait;
use vortex_array::{ArrayData, IntoArrayData, IntoArrayVariant};
use vortex_array::{ArrayDType, ArrayData, IntoArrayData, IntoArrayVariant};
use vortex_dtype::{match_each_unsigned_integer_ptype, NativePType};
use vortex_error::VortexResult;

Expand All @@ -12,11 +12,14 @@ use crate::bitpacking::compute::take::UNPACK_CHUNK_THRESHOLD;
use crate::{BitPackedArray, BitPackedEncoding};

impl FilterFn<BitPackedArray> for BitPackedEncoding {
#[allow(clippy::panic_in_result_fn)]
fn filter(&self, array: &BitPackedArray, mask: FilterMask) -> VortexResult<ArrayData> {
let primitive = match_each_unsigned_integer_ptype!(array.ptype().to_unsigned(), |$I| {
filter_primitive::<$I>(array, mask)
});
Ok(primitive?.into_array())
let prim = primitive?;
assert_eq!(prim.dtype(), array.dtype(), "BPA dtype changed in filter!");
Ok(prim.into_array())
}
}

Expand Down
11 changes: 8 additions & 3 deletions encodings/fastlanes/src/bitpacking/compute/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ use std::cmp::max;

use vortex_array::compute::SliceFn;
use vortex_array::variants::PrimitiveArrayTrait;
use vortex_array::{ArrayData, IntoArrayData};
use vortex_array::{ArrayDType, ArrayData, IntoArrayData};
use vortex_error::VortexResult;

use crate::{BitPackedArray, BitPackedEncoding};

impl SliceFn<BitPackedArray> for BitPackedEncoding {
#[allow(clippy::panic_in_result_fn)]
fn slice(&self, array: &BitPackedArray, start: usize, stop: usize) -> VortexResult<ArrayData> {
let offset_start = start + array.offset() as usize;
let offset_stop = stop + array.offset() as usize;
Expand All @@ -20,7 +21,7 @@ impl SliceFn<BitPackedArray> for BitPackedEncoding {
// slice the buffer using the encoded start/stop values

// SAFETY: the invariants of the original BitPackedArray are preserved when slicing.
unsafe {
let sliced = unsafe {
BitPackedArray::new_unchecked_with_offset(
array.packed().slice(encoded_start..encoded_stop),
array.ptype(),
Expand All @@ -35,7 +36,11 @@ impl SliceFn<BitPackedArray> for BitPackedEncoding {
offset as u16,
)
}
.map(|a| a.into_array())
.map(|a| a.into_array())?;

assert_eq!(sliced.dtype(), array.dtype(), "BPA slice changed type");

Ok(sliced)
}
}

Expand Down

0 comments on commit 34be58d

Please sign in to comment.