klion26 commented on code in PR #9276:
URL: https://github.com/apache/arrow-rs/pull/9276#discussion_r2799793798
##########
parquet-variant-compute/src/shred_variant.rs:
##########
@@ -533,17 +535,20 @@ impl ShreddedSchemaBuilder {
///
/// # Arguments
///
- /// * `path` - Anything convertible to [`VariantPath`] (e.g., a `&str`)
+ /// * `path` - Anything convertible to [`VariantPath`]
/// * `field` - Anything convertible via [`IntoShreddingField`] (e.g.
`FieldRef`,
/// `&DataType`, or `(&DataType, bool)` to control nullability)
- pub fn with_path<'a, P, F>(mut self, path: P, field: F) -> Self
+ pub fn with_path<'a, P, F>(mut self, path: P, field: F) -> Result<Self>
where
- P: Into<VariantPath<'a>>,
+ P: TryInto<VariantPath<'a>>,
+ P::Error: std::fmt::Debug,
F: IntoShreddingField,
{
- let path: VariantPath<'a> = path.into();
+ let path: VariantPath<'a> = path
+ .try_into()
+ .map_err(|e| ArrowError::InvalidArgumentError(format!("{:?}",
e)))?;
Review Comment:
Use this line and L544, because we'll have `VaraintPath` -> `VariantPath`,
which is `Infallible`, and there is no `From<Infallible>` for `ArrowError`,
`ArrowError` is located in `arrow-schema`, not sure if it's appropriate to make
the change there. If add `From<Infallible>` for `ArrowError` is better, I can
change it.
--
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]