tustvold commented on code in PR #6757:
URL: https://github.com/apache/arrow-rs/pull/6757#discussion_r1854025967
##########
parquet/src/arrow/schema/complex.rs:
##########
@@ -448,15 +448,21 @@ impl Visitor {
};
}
+ // test to see if the repeated field is a struct or one-tuple
let items = repeated_field.get_fields();
if items.len() != 1
- || repeated_field.name() == "array"
- || repeated_field.name() == format!("{}_tuple", list_type.name())
+ || (!repeated_field.is_list()
Review Comment:
Why is this check necessary, given we're in visit_list?
##########
parquet/src/schema/types.rs:
##########
@@ -202,6 +202,29 @@ impl Type {
self.get_basic_info().has_repetition()
&& self.get_basic_info().repetition() != Repetition::REQUIRED
}
+
+ /// Returns `true` if this type is annotated as a list.
+ pub fn is_list(&self) -> bool {
+ if self.is_group() {
+ let basic_info = self.get_basic_info();
+ if let Some(logical_type) = basic_info.logical_type() {
+ return logical_type == LogicalType::List;
+ }
+ return basic_info.converted_type() == ConvertedType::LIST;
+ }
+ false
+ }
+
+ /// Returns `true` if this type is a group with a single child field that
is `repeated`.
+ pub fn has_single_repeated_child(&self) -> bool {
Review Comment:
```suggestion
pub(crate) fn has_single_repeated_child(&self) -> bool {
```
This seems pretty niche.
##########
parquet/src/arrow/schema/complex.rs:
##########
@@ -448,15 +448,21 @@ impl Visitor {
};
}
+ // test to see if the repeated field is a struct or one-tuple
let items = repeated_field.get_fields();
if items.len() != 1
- || repeated_field.name() == "array"
- || repeated_field.name() == format!("{}_tuple", list_type.name())
+ || (!repeated_field.is_list()
+ && !repeated_field.has_single_repeated_child()
Review Comment:
```suggestion
&& items[0].get_basic_info().repetition() !=
Repetition::REPEATED
```
##########
parquet/src/schema/types.rs:
##########
@@ -202,6 +202,29 @@ impl Type {
self.get_basic_info().has_repetition()
&& self.get_basic_info().repetition() != Repetition::REQUIRED
}
+
+ /// Returns `true` if this type is annotated as a list.
+ pub fn is_list(&self) -> bool {
Review Comment:
```suggestion
pub(crate) fn is_list(&self) -> bool {
```
I'm a bit wary of exposing this given how confusing the notion of a list is
in parquet
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]