Skip to content

Commit

Permalink
CR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamGS committed Aug 15, 2024
1 parent eeffdba commit 7eeb4ed
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 20 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ edition = "2021"
rust-version = "1.76"

[workspace.dependencies]
libfuzzer-sys = "0.4"
ahash = "0.8.11"
allocator-api2 = "0.2.16"
anyhow = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion bench-vortex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ arrow-schema = { workspace = true }
arrow-select = { workspace = true }
bytes = { workspace = true }
bzip2 = { workspace = true }
csv = { workspace = true }
clap = { workspace = true, features = ["derive"] }
csv = { workspace = true }
datafusion = { workspace = true }
enum-iterator = { workspace = true }
flexbuffers = { workspace = true }
Expand Down
3 changes: 1 addition & 2 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = { workspace = true }
cargo-fuzz = true

[dependencies]
libfuzzer-sys = { version = "0.4" }
libfuzzer-sys = { workspace = true }
vortex-array = { workspace = true, features = ["arbitrary"] }
vortex-dtype = { workspace = true }
vortex-sampling-compressor = { workspace = true }
Expand All @@ -19,7 +19,6 @@ vortex-scalar = { workspace = true }
name = "vortex_fuzz"
path = "src/lib.rs"


[[bin]]
name = "fuzz_target_1"
path = "fuzz_targets/fuzz_target_1.rs"
Expand Down
6 changes: 3 additions & 3 deletions fuzz/fuzz_targets/fuzz_target_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ use vortex_sampling_compressor::SamplingCompressor;
use vortex_scalar::{PValue, Scalar, ScalarValue};

fuzz_target!(|fuzz_action: FuzzArrayAction| -> Corpus {
let FuzzArrayAction { array, action } = fuzz_action;
let FuzzArrayAction { array, actions } = fuzz_action;

// TODO(adamg): We actually might want to test empty things, but I'm punting this issue for now
if array.is_empty() {
return Corpus::Reject;
};

match action {
Action::Compress(c) => match fuzz_compress(&array, c.as_ref()) {
match &actions[0] {
Action::Compress(c) => match fuzz_compress(&array, *c) {
Some(compressed_array) => {
assert_array_eq(&array, &compressed_array);
Corpus::Keep
Expand Down
29 changes: 16 additions & 13 deletions fuzz/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ use vortex_sampling_compressor::compressors::EncodingCompressor;

pub struct FuzzArrayAction {
pub array: Array,
pub action: Action,
pub actions: Vec<Action>,
}

impl std::fmt::Debug for FuzzArrayAction {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("FuzzArrayAction")
.field("action", &self.action)
.field("action", &self.actions)
.field("array", &self.array)
.finish()
}
Expand All @@ -30,7 +30,7 @@ impl std::fmt::Debug for FuzzArrayAction {
#[derive()]
pub enum Action {
NoOp,
Compress(Box<dyn EncodingCompressor>),
Compress(&'static dyn EncodingCompressor),
Slice(Range<usize>),
}

Expand All @@ -53,18 +53,21 @@ impl<'a> Arbitrary<'a> for FuzzArrayAction {
let stop = u.choose_index(array.len() - start)? + start;
Action::Slice(start..stop)
}
1 => Action::Compress(Box::new(ALPCompressor) as _),
2 => Action::Compress(Box::new(BitPackedCompressor) as _),
3 => Action::Compress(Box::new(DictCompressor) as _),
4 => Action::Compress(Box::new(FoRCompressor) as _),
5 => Action::Compress(Box::new(RoaringBoolCompressor) as _),
6 => Action::Compress(Box::new(RoaringIntCompressor) as _),
7 => Action::Compress(Box::new(DEFAULT_RUN_END_COMPRESSOR) as _),
8 => Action::Compress(Box::new(SparseCompressor) as _),
9 => Action::Compress(Box::new(ZigZagCompressor) as _),
1 => Action::Compress(&ALPCompressor),
2 => Action::Compress(&BitPackedCompressor),
3 => Action::Compress(&DictCompressor),
4 => Action::Compress(&FoRCompressor),
5 => Action::Compress(&RoaringBoolCompressor),
6 => Action::Compress(&RoaringIntCompressor),
7 => Action::Compress(&DEFAULT_RUN_END_COMPRESSOR),
8 => Action::Compress(&SparseCompressor),
9 => Action::Compress(&ZigZagCompressor),
_ => Action::NoOp,
};

Ok(Self { array, action })
Ok(Self {
array,
actions: vec![action],
})
}
}
2 changes: 1 addition & 1 deletion vortex-expr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ prost = { workspace = true, optional = true }
serde = { workspace = true, optional = true, features = ["derive"] }
vortex-dtype = { workspace = true }
vortex-error = { workspace = true }
vortex-scalar = { workspace = true }
vortex-proto = { workspace = true, optional = true }
vortex-scalar = { workspace = true }

[features]
datafusion = ["dep:datafusion-common", "dep:datafusion-expr", "vortex-scalar/datafusion"]
Expand Down

0 comments on commit 7eeb4ed

Please sign in to comment.