Skip to content

Commit 7c6aeb9

Browse files
committed
BoolArray::new
Signed-off-by: Nicholas Gates <[email protected]>
2 parents ee7cb6b + ba0e97a commit 7c6aeb9

File tree

32 files changed

+1968
-753
lines changed

32 files changed

+1968
-753
lines changed

.github/workflows/claude.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Claude Code
22

33
concurrency:
44
# We shouldn't have multiple instances of Claude running on the same PR.
5-
group: ${{ github.event.issue.number || github.event.pull_request.number }}
6-
cancel-in-progress: true
5+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
6+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
77

88
on:
99
issue_comment:

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ jiff = "0.2.0"
134134
kanal = "0.1.1"
135135
lending-iterator = "0.1.7"
136136
libfuzzer-sys = "0.4"
137-
log = { version = "0.4" }
137+
log = { version = "0.4.21" }
138138
loom = { version = "0.7", features = ["checkpoint"] }
139139
memmap2 = "0.9.5"
140140
mimalloc = "0.1.42"

vortex-array/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,9 @@ harness = false
159159
name = "take_primitive"
160160
harness = false
161161

162+
[[bench]]
163+
name = "take_struct"
164+
harness = false
165+
162166
[package.metadata.cargo-machete]
163167
ignored = ["getrandom_v03"]
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3+
4+
#![allow(clippy::unwrap_used)]
5+
6+
use divan::Bencher;
7+
use rand::Rng;
8+
use rand::SeedableRng;
9+
use rand::distr::Uniform;
10+
use rand::rngs::StdRng;
11+
use vortex_array::IntoArray;
12+
use vortex_array::arrays::StructArray;
13+
use vortex_array::compute::take;
14+
use vortex_array::validity::Validity;
15+
use vortex_buffer::Buffer;
16+
use vortex_dtype::FieldNames;
17+
18+
fn main() {
19+
divan::main();
20+
}
21+
22+
const ARRAY_SIZE: usize = 100_000;
23+
const TAKE_SIZE: usize = 1000;
24+
25+
#[divan::bench]
26+
fn take_struct_simple(bencher: Bencher) {
27+
let mut rng = StdRng::seed_from_u64(0);
28+
let range = Uniform::new(0i64, 100_000_000).unwrap();
29+
30+
// Create single field for the struct
31+
let field = (0..ARRAY_SIZE)
32+
.map(|_| rng.sample(range))
33+
.collect::<Buffer<i64>>()
34+
.into_array();
35+
36+
let struct_array = StructArray::try_new(
37+
FieldNames::from(["value"]),
38+
vec![field],
39+
ARRAY_SIZE,
40+
Validity::NonNullable,
41+
)
42+
.unwrap();
43+
44+
let indices: Buffer<u64> = (0..TAKE_SIZE)
45+
.map(|_| rng.random_range(0..ARRAY_SIZE) as u64)
46+
.collect();
47+
let indices_array = indices.into_array();
48+
49+
bencher
50+
.with_inputs(|| (&struct_array, &indices_array))
51+
.bench_refs(|(array, indices)| take(array.as_ref(), indices.as_ref()).unwrap());
52+
}
53+
54+
#[divan::bench(args = [8])]
55+
fn take_struct_wide(bencher: Bencher, width: usize) {
56+
let mut rng = StdRng::seed_from_u64(0);
57+
let range = Uniform::new(0i64, 100_000_000).unwrap();
58+
59+
let fields: Vec<_> = (0..width)
60+
.map(|_| {
61+
(0..ARRAY_SIZE)
62+
.map(|_| rng.sample(range))
63+
.collect::<Buffer<i64>>()
64+
.into_array()
65+
})
66+
.collect();
67+
68+
let field_names = FieldNames::from([
69+
"field1", "field2", "field3", "field4", "field5", "field6", "field7", "field8",
70+
]);
71+
72+
let struct_array =
73+
StructArray::try_new(field_names, fields, ARRAY_SIZE, Validity::NonNullable).unwrap();
74+
75+
let indices: Buffer<u64> = (0..TAKE_SIZE)
76+
.map(|_| rng.random_range(0..ARRAY_SIZE) as u64)
77+
.collect();
78+
let indices_array = indices.into_array();
79+
80+
bencher
81+
.with_inputs(|| (&struct_array, &indices_array))
82+
.bench_refs(|(array, indices)| take(array.as_ref(), indices.as_ref()).unwrap());
83+
}
84+
85+
#[divan::bench]
86+
fn take_struct_sequential_indices(bencher: Bencher) {
87+
let mut rng = StdRng::seed_from_u64(0);
88+
let range = Uniform::new(0i64, 100_000_000).unwrap();
89+
90+
// Create single field for the struct
91+
let field = (0..ARRAY_SIZE)
92+
.map(|_| rng.sample(range))
93+
.collect::<Buffer<i64>>()
94+
.into_array();
95+
96+
let struct_array = StructArray::try_new(
97+
FieldNames::from(["value"]),
98+
vec![field],
99+
ARRAY_SIZE,
100+
Validity::NonNullable,
101+
)
102+
.unwrap();
103+
104+
// Sequential indices for better cache performance
105+
let indices: Buffer<u64> = (0..TAKE_SIZE as u64).collect();
106+
let indices_array = indices.into_array();
107+
108+
bencher
109+
.with_inputs(|| (&struct_array, &indices_array))
110+
.bench_refs(|(array, indices)| take(array.as_ref(), indices.as_ref()).unwrap());
111+
}

vortex-array/src/expr/exprs/list_contains.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ fn constant_list_scalar_contains(list: ListViewScalar, values: Vector) -> Vortex
314314
.ensure_vector(values.len())
315315
.into_bool();
316316

317-
result = LogicalOr::or(result, &compared);
317+
result = LogicalOr::or(&result, &compared);
318318
}
319319

320320
Ok(result)

vortex-compute/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ vortex-mask = { workspace = true, features = ["arrow"] }
3131
vortex-vector = { workspace = true }
3232

3333
half = { workspace = true }
34+
itertools = { workspace = true }
35+
log = { workspace = true }
3436
multiversion = { workspace = true }
3537
num-traits = { workspace = true }
3638
paste = { workspace = true }

vortex-compute/src/filter/vector/fixed_size_list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ where
3232
type Output = FixedSizeListVector;
3333

3434
fn filter(self, selection: &M) -> Self::Output {
35-
let list_size = self.element_size();
35+
let list_size = self.list_size();
3636
let filtered_validity = self.validity().filter(selection);
3737

3838
let filtered_elements = if list_size != 0 {

vortex-compute/src/logical/and.rs

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)