knutin opened a new issue #390: URL: https://github.com/apache/arrow-rs/issues/390
**Describe the bug** When using `Array::slice` to create a new array containing just a subset of an existing array, a StreamWriter will write the entire array and not respect the slice offset. **To Reproduce** Here's a repository which reproduces the problem: https://github.com/knutin/arrow-slice-bug/blob/7c299c9df2612c5bfe95d2ca41c25697adff96cf/src/main.rs#L10 ``` fn main() { let array = UInt32Array::from(vec![Some(1), Some(2), Some(3)]); assert_eq!(vec![Some(1), Some(2), Some(3)], array.iter().collect::<Vec<_>>()); let sliced = array.slice(1, 2); let read_sliced: &UInt32Array = as_primitive_array(&sliced); assert_eq!(vec![Some(2), Some(3)], read_sliced.iter().collect::<Vec<_>>()); let batch = RecordBatch::try_new( Arc::new(Schema::new(vec![Field::new("a", DataType::UInt32, true)])), vec![Arc::new(array)], ).expect("new batch"); let mut writer = StreamWriter::try_new(vec![], &batch.schema()).expect("new writer"); writer.write(&batch).expect("write"); let outbuf = writer.into_inner().expect("inner"); let mut reader = StreamReader::try_new(&outbuf[..]).expect("new reader"); let read_batch = reader.next().unwrap().expect("read batch"); let read_array: &UInt32Array = as_primitive_array(read_batch.column(0)); assert_eq!(vec![Some(2), Some(3)], read_array.iter().collect::<Vec<_>>()); } ``` **Expected behavior** I expected the StreamWriter to only write the sliced portion of the Array. -- 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. For queries about this service, please contact Infrastructure at: [email protected]
