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


##########
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:
   This might be a bit better as it drops the value early
   ```suggestion
                       match target.try_value(i) {
                           Ok(v) => {
                               let _ = builder.append_value(v)?;
                           }
                           Err(_) => 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