Skip to content

Commit 41b39ea

Browse files
joseph-isaacsdimitarvdimitrov
authored andcommitted
chore[fuzz]: (temp) remove duplicate struct field names (#7073)
This fuzzer is stuck on duplicate field name bugs, this PR unsticks it until we decide on how to handle it Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
1 parent 99320db commit 41b39ea

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • vortex-array/src/dtype/arbitrary

vortex-array/src/dtype/arbitrary/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::sync::Arc;
66
use arbitrary::Arbitrary;
77
use arbitrary::Result;
88
use arbitrary::Unstructured;
9+
use itertools::Itertools;
910
use vortex_error::VortexExpect;
1011

1112
use crate::dtype::DType;
@@ -108,11 +109,15 @@ impl<'a> Arbitrary<'a> for StructFields {
108109
}
109110
}
110111

112+
// TODO(joe): enable duplicate field gen in the fuzzer.
113+
// we dont for now to unblock this to find more interesting things
111114
fn random_struct_dtype(u: &mut Unstructured<'_>, depth: u8) -> Result<StructFields> {
112115
let field_count = u.choose_index(3)?;
113-
let names: FieldNames = (0..field_count)
116+
let names: Vec<FieldName> = (0..field_count)
114117
.map(|_| FieldName::arbitrary(u))
115-
.collect::<Result<FieldNames>>()?;
118+
.collect::<Result<Vec<_>>>()?;
119+
// Deduplicate field names, keeping only the first occurrence of each.
120+
let names: FieldNames = names.into_iter().unique().collect();
116121
let dtypes = (0..names.len())
117122
.map(|_| random_dtype(u, depth))
118123
.collect::<Result<Vec<_>>>()?;

0 commit comments

Comments
 (0)