Rich-T-kid opened a new issue, #11116:
URL: https://github.com/apache/arrow-rs/issues/11116

   **Is your feature request related to a problem or challenge?**
   
   Part of https://github.com/apache/arrow-rs/issues/7761
   
   `MapArray` goes through `GenericInProgressArray` → `concat_maps`. A MapArray 
is structurally identical to `List<Struct<key, value>>` — it has an offset 
buffer and an entries `StructArray` child. A specialized implementation mirrors 
the proposed `InProgressListArray` (see the companion List issue) but with the 
entries child dispatched to `InProgressStructArray`.
   
   **Describe the solution you'd like**
   
   ```rust
   pub(crate) struct InProgressMapArray {
       entries_field: FieldRef,
       ordered: bool,
       source: Option<ArrayRef>,
       batch_size: usize,
       nulls: NullBufferBuilder,
       offsets: Vec<i32>,  // Map always uses i32 offsets
       entries: InProgressStructArray,  // entries is always a StructArray
   }
   ```
   
   **Implementation ideas:**
   
   1. **Reuse `InProgressListArray` logic**: the offset accumulation for Map is 
identical to `List<i32>` — factor out a common `InProgressOffsetArray` trait or 
helper
   2. **Entries specialization**: the entries child is always a `StructArray` 
with key and value fields; use `InProgressStructArray` for the entries, which 
recursively specializes key and value fields
   3. **Combined benefit**: a `Map<Utf8, Int64>` gets:
      - Incremental i32 offsets (vs. scan-then-reconstruct in `concat_maps`)
      - Entries struct with `InProgressPrimitiveArray` for the Int64 values
      - Keys as Utf8 (through GenericInProgressArray for now, or specialized if 
List PR lands)
   
   **`create_in_progress_array` dispatch:**
   
   ```rust
   DataType::Map(field, ordered) => {
       // entries field is always a StructArray containing key+value fields
       Box::new(InProgressMapArray::new(Arc::clone(field), *ordered, 
batch_size))
   }
   ```
   
   **Benchmarks**
   
   ```
   cargo bench --bench coalesce_kernels --features test_utils -- map
   ```


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