alamb commented on code in PR #7946: URL: https://github.com/apache/arrow-rs/pull/7946#discussion_r2216788578
########## parquet-variant-compute/src/variant_array.rs: ########## @@ -154,6 +155,172 @@ impl VariantArray { fn find_value_field(array: &StructArray) -> Option<ArrayRef> { array.column_by_name("value").cloned() } + /// Extract a field from the variant at the specified row using a path. + /// + /// This method provides direct access to nested fields without reconstructing + /// the entire variant, which is critical for performance with shredded variants. + /// + /// # Arguments + /// * `index` - The row index in the array + /// * `path` - The path to the field to extract + /// + /// # Returns + /// * `Some(Variant)` if the field exists at the specified path + /// * `None` if the field doesn't exist or the path is invalid + /// + /// # Example + /// ``` + /// # use parquet_variant_compute::{VariantArrayBuilder, VariantArray, VariantPath}; + /// # use parquet_variant::VariantBuilder; + /// # let mut builder = VariantArrayBuilder::new(1); + /// # let mut variant_builder = VariantBuilder::new(); + /// # let mut obj = variant_builder.new_object(); + /// # obj.insert("name", "Alice"); + /// # obj.finish().unwrap(); + /// # let (metadata, value) = variant_builder.finish(); + /// # builder.append_variant_buffers(&metadata, &value); + /// # let variant_array = builder.build(); + /// let path = VariantPath::field("name"); + /// let name_variant = variant_array.get_path(0, &path); + /// ``` + pub fn get_path(&self, index: usize, path: &VariantPath) -> Option<Variant> { Review Comment: I wonder how this is different than `variant_get` 🤔 https://github.com/apache/arrow-rs/blob/99eb1bc92b129b0431cf79292cfa6361bb74cfc4/parquet-variant-compute/src/variant_get.rs#L35 -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org