• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vortex-data / vortex / 16275167045

14 Jul 2025 06:46PM UTC coverage: 81.537%. Remained the same
16275167045

Pull #3873

github

web-flow
Merge 2a3476556 into 65447ae8a
Pull Request #3873: chore: use incrementing field names for fuzzer

0 of 2 new or added lines in 1 file covered. (0.0%)

4 existing lines in 1 file now uncovered.

46270 of 56747 relevant lines covered (81.54%)

146750.2 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/vortex-expr/src/arbitrary.rs
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3

4
use std::cmp::max;
5

6
use arbitrary::{Result as AResult, Unstructured};
7
use vortex_dtype::{DType, FieldName};
8
use vortex_scalar::arbitrary::random_scalar;
9

10
use crate::{BinaryExpr, ExprRef, Operator, and_collect, get_item_scope, lit, pack};
11

12
pub fn projection_expr(u: &mut Unstructured<'_>, dtype: &DType) -> AResult<Option<ExprRef>> {
×
13
    let Some(struct_dtype) = dtype.as_struct() else {
×
14
        return Ok(None);
×
15
    };
16

17
    let column_count = u.int_in_range::<usize>(0..=max(struct_dtype.nfields(), 10))?;
×
18

19
    let cols = (0..column_count)
×
20
        .map(|_| {
×
21
            let get_item = u.choose_iter(struct_dtype.names().iter())?;
×
22
            Ok((get_item.clone(), get_item_scope(get_item.clone())))
×
23
        })
×
24
        .collect::<AResult<Vec<_>>>()?;
×
25

26
    Ok(Some(pack(cols, u.arbitrary()?)))
×
27
}
×
28

29
pub fn filter_expr(u: &mut Unstructured<'_>, dtype: &DType) -> AResult<Option<ExprRef>> {
×
30
    let Some(struct_dtype) = dtype.as_struct() else {
×
31
        return Ok(None);
×
32
    };
33

34
    let filter_count = u.int_in_range::<usize>(0..=max(struct_dtype.nfields(), 10))?;
×
35

36
    let filters = (0..filter_count)
×
37
        .map(|_| {
×
38
            let (col, dtype) =
×
39
                u.choose_iter(struct_dtype.names().iter().zip(struct_dtype.fields()))?;
×
40
            random_comparison(u, col, &dtype)
×
41
        })
×
42
        .collect::<AResult<Vec<_>>>()?;
×
43

44
    Ok(and_collect(filters))
×
45
}
×
46

47
fn random_comparison(u: &mut Unstructured<'_>, col: &FieldName, dtype: &DType) -> AResult<ExprRef> {
×
48
    let scalar = random_scalar(u, dtype)?;
×
49
    Ok(BinaryExpr::new_expr(
UNCOV
50
        get_item_scope(col.clone()),
×
51
        arbitrary_comparison_operator(u)?,
×
52
        lit(scalar),
×
53
    ))
54
}
×
55

UNCOV
56
fn arbitrary_comparison_operator(u: &mut Unstructured<'_>) -> AResult<Operator> {
×
57
    Ok(match u.int_in_range(0..=5)? {
×
58
        0 => Operator::Eq,
×
59
        1 => Operator::NotEq,
×
UNCOV
60
        2 => Operator::Gt,
×
61
        3 => Operator::Gte,
×
UNCOV
62
        4 => Operator::Lt,
×
63
        5 => Operator::Lte,
×
64
        _ => unreachable!("range 0..=5"),
×
65
    })
66
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc