Skip to content

Commit

Permalink
fix parquet type is_optional
Browse files Browse the repository at this point in the history
  • Loading branch information
jp0317 committed Aug 4, 2024
1 parent f2de2cd commit 6d9e13c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions parquet/src/schema/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ impl Type {
/// Returns `true` if this type is repeated or optional.
/// If this type doesn't have repetition defined, we still treat it as optional.
pub fn is_optional(&self) -> bool {
self.get_basic_info().has_repetition()
&& self.get_basic_info().repetition() != Repetition::REQUIRED
!self.get_basic_info().has_repetition()
|| self.get_basic_info().repetition() != Repetition::REQUIRED
}
}

Expand Down Expand Up @@ -1932,6 +1932,7 @@ mod tests {
let f1 = Type::group_type_builder("f").build().unwrap();
let f2 = Type::group_type_builder("f").build().unwrap();
assert!(f1.check_contains(&f2));
assert!(f1.is_optional());

// OK: fields match
let f1 = test_new_group_type(
Expand Down

0 comments on commit 6d9e13c

Please sign in to comment.