tustvold commented on issue #4408: URL: https://github.com/apache/arrow-rs/issues/4408#issuecomment-1589678323
A MapArray is a stored using the [variable sized list layout](https://arrow.apache.org/docs/format/Columnar.html#variable-size-list-layout). As such it has an offsets buffer that determines the length of its children. So in your example to access the value you could either use `MapArray::value` ``` let v = map.value(0); assert_eq!(v.len(), 1); let keys = v.column(0).as_primitive::<UInt32Type>(); let values = v.column(1).as_primitive::<UInt32Type>(); assert_eq!(keys.value(0), values.value(0)); assert_eq!(keys.value(0), SLICE_OFFSET as u32); ``` Or you can access the underlying arrays directly, using `value_offsets`, and apply this to `MapArray::keys` and `MapArray::values` -- 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]
