Skip to content

Commit 8c161ec

Browse files
Remove unique field check
1 parent 34e044b commit 8c161ec

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

arrow-schema/src/fields.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,6 @@ impl UnionFields {
343343
///
344344
/// This function returns an error if:
345345
/// - Any type_id appears more than once (duplicate type ids)
346-
/// - Any field appears more than once (duplicate fields)
347346
/// - The number of type_ids doesn't match the number of fields
348347
///
349348
/// # Examples
@@ -362,7 +361,7 @@ impl UnionFields {
362361
/// );
363362
/// assert!(result.is_ok());
364363
///
365-
/// // This will fail due to duplicate type id
364+
/// // This will fail due to duplicate type ids
366365
/// let result = UnionFields::try_new(
367366
/// vec![1, 1],
368367
/// vec![
@@ -384,7 +383,6 @@ impl UnionFields {
384383
let fields_capacity = fields_iter.size_hint().0;
385384

386385
let mut seen_type_ids = 0u128;
387-
let mut seen_fields = HashSet::with_capacity(fields_capacity);
388386

389387
let mut out = Vec::new();
390388

@@ -409,13 +407,6 @@ impl UnionFields {
409407

410408
seen_type_ids |= mask;
411409

412-
// check field id uniqueness
413-
if !seen_fields.insert(Arc::clone(&field)) {
414-
return Err(ArrowError::InvalidArgumentError(format!(
415-
"duplicate field: {field}"
416-
)));
417-
}
418-
419410
out.push((type_id, field));
420411
}
421412
(None, Some(_)) => {
@@ -764,8 +755,7 @@ mod tests {
764755
fn test_union_fields_try_new_duplicate_field() {
765756
let field = Field::new("field", DataType::UInt8, false);
766757
let res = UnionFields::try_new(vec![1, 2], vec![field.clone(), field]);
767-
assert!(res.is_err());
768-
assert!(res.unwrap_err().to_string().contains("duplicate field"));
758+
assert!(res.is_ok());
769759
}
770760

771761
#[test]

0 commit comments

Comments
 (0)