friendlymatthew commented on code in PR #8839:
URL: https://github.com/apache/arrow-rs/pull/8839#discussion_r2593585422


##########
arrow-row/src/lib.rs:
##########
@@ -1762,6 +1880,111 @@ unsafe fn decode_column(
             },
             _ => unreachable!(),
         },
+        Codec::Union(converters, null_rows) => {
+            let len = rows.len();
+
+            let DataType::Union(union_fields, mode) = &field.data_type else {
+                unreachable!()
+            };
+
+            let mut type_ids = Vec::with_capacity(len);
+            let mut rows_by_field: Vec<Vec<(usize, &[u8])>> = vec![Vec::new(); 
converters.len()];
+
+            for (idx, row) in rows.iter_mut().enumerate() {
+                let mut cursor = 0;
+
+                let type_id_byte = {
+                    let id = row[cursor];
+                    cursor += 1;
+
+                    if options.descending { !id } else { id }
+                };
+
+                let type_id = type_id_byte as i8;
+                type_ids.push(type_id);
+
+                let field_idx = type_id as usize;
+
+                let child_row = &row[cursor..];
+                rows_by_field[field_idx].push((idx, child_row));
+
+                *row = &row[row.len()..];
+            }
+
+            let mut child_arrays: Vec<ArrayRef> = 
Vec::with_capacity(converters.len());
+
+            let mut offsets = (*mode == UnionMode::Dense).then(|| 
Vec::with_capacity(len));
+
+            for (field_idx, converter) in converters.iter().enumerate() {
+                let field_rows = &rows_by_field[field_idx];
+
+                match &mode {
+                    UnionMode::Dense => {
+                        if field_rows.is_empty() {
+                            let (_, field) = 
union_fields.iter().nth(field_idx).unwrap();

Review Comment:
   This should address it! https://github.com/apache/arrow-rs/pull/8959



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