klion26 commented on code in PR #12310:
URL: https://github.com/apache/arrow-rs/pull/12310#discussion_r4754705835
##########
parquet-variant-compute/src/variant_get.rs:
##########
@@ -198,6 +198,59 @@ pub(crate) fn follow_shredded_path_element(
}
}
+/// Extracts `path` from an unshredded variant column, reading each row's
encoded bytes directly.
+///
+/// A row reads only the headers and field names along `path`, and decodes
only the value it finds.
+fn get_path_from_bytes(
+ target: &VariantArray,
+ path: &[VariantPathElement<'_>],
+ as_type: Option<&DataType>,
+ cast_options: &CastOptions,
+) -> Result<ArrayRef> {
+ let mut builder = make_variant_to_arrow_row_builder(
+ target.metadata_column(),
+ VariantPath::default(),
+ as_type,
+ cast_options,
+ target.len(),
+ )?;
+ let metadata = BinaryColumn::new(target.metadata_column());
+ let value = BinaryColumn::new(target.value_column());
+
+ for i in 0..target.len() {
+ if target.is_null(i) {
+ builder.append_null()?;
+ continue;
+ }
+ // A row with neither `value` nor `typed_value` is `Variant::Null`,
which has no fields.
+ let Some(value) = value.value(i) else {
+ match path.is_empty() {
+ true => builder.append_value(Variant::Null).map(drop)?,
Review Comment:
why do we need to call `map(drop)` here?
--
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]