tustvold commented on code in PR #2626:
URL: https://github.com/apache/arrow-rs/pull/2626#discussion_r967184411
##########
parquet/src/basic.rs:
##########
@@ -730,113 +736,129 @@ impl From<Option<LogicalType>> for ConvertedType {
// ----------------------------------------------------------------------
// parquet::FieldRepetitionType <=> Repetition conversion
-impl From<parquet::FieldRepetitionType> for Repetition {
- fn from(value: parquet::FieldRepetitionType) -> Self {
- match value {
- parquet::FieldRepetitionType::Required => Repetition::REQUIRED,
- parquet::FieldRepetitionType::Optional => Repetition::OPTIONAL,
- parquet::FieldRepetitionType::Repeated => Repetition::REPEATED,
- }
+impl TryFrom<parquet::FieldRepetitionType> for Repetition {
+ type Error = ParquetError;
+
+ fn try_from(value: parquet::FieldRepetitionType) -> Result<Self> {
+ Ok(match value {
+ parquet::FieldRepetitionType::REQUIRED => Repetition::REQUIRED,
+ parquet::FieldRepetitionType::OPTIONAL => Repetition::OPTIONAL,
+ parquet::FieldRepetitionType::REPEATED => Repetition::REPEATED,
+ _ => return Err(general_err!("unexpected repetition type: {}",
value.0)),
Review Comment:
> potential stack to know what the context is
If only there was a well established solution to this conundrum... *grumble*
:laughing:
--
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]