-
Notifications
You must be signed in to change notification settings - Fork 225
Expand file tree
/
Copy pathmod.rs
More file actions
43 lines (39 loc) · 1.35 KB
/
Copy pathmod.rs
File metadata and controls
43 lines (39 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors
use arbitrary::Arbitrary;
use arbitrary::Unstructured;
use vortex_array::ArrayRef;
use vortex_array::arrays::arbitrary::ArbitraryArray;
use vortex_array::arrays::arbitrary::ArbitraryArrayConfig;
use vortex_array::arrays::arbitrary::ArbitraryWith;
use vortex_array::expr::Expression;
use vortex_array::expr::arbitrary::filter_expr;
use vortex_array::expr::arbitrary::projection_expr;
use crate::FUZZ_ARRAY_MAX_LEN;
use crate::array::CompressorStrategy;
#[derive(Debug)]
pub struct FuzzFileAction {
pub array: ArrayRef,
pub projection_expr: Option<Expression>,
pub filter_expr: Option<Expression>,
pub compressor_strategy: CompressorStrategy,
}
impl<'a> Arbitrary<'a> for FuzzFileAction {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
let array = ArbitraryArray::arbitrary_with_config(
u,
&ArbitraryArrayConfig {
dtype: None,
len: 0..=FUZZ_ARRAY_MAX_LEN,
},
)?
.0;
let dtype = array.dtype().clone();
Ok(FuzzFileAction {
array,
projection_expr: projection_expr(u, &dtype)?,
filter_expr: filter_expr(u, &dtype)?,
compressor_strategy: CompressorStrategy::arbitrary(u)?,
})
}
}