From 7cc42cee5674efd2665ef9d97532e8a83781f3a1 Mon Sep 17 00:00:00 2001 From: Pieter Raubenheimer Date: Sat, 27 Apr 2024 17:52:15 +0100 Subject: [PATCH] Clippy and code comment suggestion --- parquet/src/arrow/arrow_reader/mod.rs | 2 +- parquet/src/arrow/schema/complex.rs | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/parquet/src/arrow/arrow_reader/mod.rs b/parquet/src/arrow/arrow_reader/mod.rs index 347cd24323f9..c942461f37e7 100644 --- a/parquet/src/arrow/arrow_reader/mod.rs +++ b/parquet/src/arrow/arrow_reader/mod.rs @@ -1458,7 +1458,7 @@ mod tests { ])), false, )), - false.into(), + false, ), true, )])); diff --git a/parquet/src/arrow/schema/complex.rs b/parquet/src/arrow/schema/complex.rs index fc5ce024770e..3107a282e0db 100644 --- a/parquet/src/arrow/schema/complex.rs +++ b/parquet/src/arrow/schema/complex.rs @@ -286,8 +286,16 @@ impl Visitor { let map_key = &map_key_value.get_fields()[0]; let map_value = &map_key_value.get_fields()[1]; - if map_key.get_basic_info().repetition() == Repetition::REPEATED { + match map_key.get_basic_info().repetition() { + Repetition::REPEATED => { return Err(arrow_err!("Map keys cannot be repeated")); + } + Repetition::REQUIRED | Repetition::OPTIONAL => { + // Relaxed check for having repetition REQUIRED as there exists + // parquet writers and files that do not conform to this standard. + // This allows us to consume a broader range of existing files even + // if they are out of spec. + } } if map_value.get_basic_info().repetition() == Repetition::REPEATED {