klion26 commented on code in PR #8719:
URL: https://github.com/apache/arrow-rs/pull/8719#discussion_r2477287023


##########
parquet-variant-compute/src/variant_get.rs:
##########
@@ -142,8 +142,17 @@ fn shredded_get_path(
             for i in 0..target.len() {
                 if target.is_null(i) {
                     builder.append_null()?;
+                } else if !cast_options.safe {
+                    let value = target.try_value(i)?;
+                    builder.append_value(value)?;
                 } else {
-                    builder.append_value(target.value(i))?;
+                    let _ = match target.try_value(i) {
+                        Ok(v) => builder.append_value(v)?,
+                        Err(_) => {
+                            builder.append_null()?;
+                            false // add this to make match arms have the same 
return type
+                        }
+                    };

Review Comment:
   I tried this, but changed to the current solution.
   We need to change the return type for `builder.append_null()`, (we need both 
match arms to return the same type), and we need to return `Ok(false)` for 
`builder.append_null()` to satisfy the semantics here, but the 
`builder.append_null` always succeeds(`builder.append_value()` will return 
`Ok(true)` if succeed). It seems weird to have different semantics for the 
return result of `builder.append_value` and `builder.append_null`.



-- 
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]

Reply via email to