emcake opened a new issue, #4408: URL: https://github.com/apache/arrow-rs/issues/4408
**Describe the bug** When using `.slice(...)` on a `RecordBatch` that contains a map column, the map does not respect the offset of the slice. **To Reproduce** The following test fails: ```rust #[test] fn encode_maps() { let key_inner = Field::new("keys", DataType::UInt32, false); let val_inner = Field::new("values", DataType::UInt32, true); let kv_inner = Field::new( "entries", arrow::datatypes::DataType::Struct(vec![key_inner.clone(), val_inner.clone()].into()), false, ); let map_field = Field::new("map", DataType::Map(Arc::new(kv_inner), false), false); let schema = Arc::new(Schema::new(vec![map_field])); let values = { let k = UInt32Builder::new(); let v = UInt32Builder::new(); let mut map = MapBuilder::new(None, k, v); for i in 0..100000 { { let k: &mut UInt32Builder = map.keys(); k.append_value(i); } { let v: &mut UInt32Builder = map.values(); v.append_value(i); } map.append(true).unwrap() } map.finish() }; let batch = RecordBatch::try_new(Arc::clone(&schema), vec![Arc::new(values)]).unwrap(); const SLICE_OFFSET: usize = 999; let sliced = batch.slice(999, 1); assert_eq!(sliced.num_rows(), 1); { let items = sliced .column(0) .as_any() .downcast_ref::<arrow::array::MapArray>() .unwrap(); let keys = items.keys().as_any().downcast_ref::<UInt32Array>().unwrap(); let values = items .values() .as_any() .downcast_ref::<UInt32Array>() .unwrap(); assert_eq!(keys.value(0), values.value(0)); assert_eq!(keys.value(0), SLICE_OFFSET as u32) // fails - 0 vs 999 } } ``` **Expected behavior** The test should pass. -- 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.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org