nevi-me commented on pull request #7693:
URL: https://github.com/apache/arrow/pull/7693#issuecomment-656917911
> @nevi-me When I was testing it we weren't seeing it while reading the
record batch back directly; we had to complete the serialization to a byte
stream and then read it back.
Yes, writing to a file stream, and reading that back, works. Try the below:
```rust
#[test]
fn test_arrow_single_float_row() {
let schema = Schema::new(vec![
Field::new("a", DataType::Float32, false),
Field::new("b", DataType::Float32, false),
Field::new("c", DataType::Int32, false),
Field::new("d", DataType::Int32, false),
]);
let arrays = vec![
Arc::new(Float32Array::from(vec![1.23])) as ArrayRef,
Arc::new(Float32Array::from(vec![-6.50])) as ArrayRef,
Arc::new(Int32Array::from(vec![2])) as ArrayRef,
Arc::new(Int32Array::from(vec![1])) as ArrayRef,
];
let batch = RecordBatch::try_new(Arc::new(schema.clone()),
arrays).unwrap();
// create stream writer
let file =
File::create("target/debug/testdata/float.stream").unwrap();
let mut stream_writer = StreamWriter::try_new(file,
&schema).unwrap();
stream_writer.write(&batch).unwrap();
stream_writer.finish().unwrap();
// read stream back
let file = File::open("target/debug/testdata/float.stream").unwrap();
let mut reader = StreamReader::try_new(file).unwrap();
let read_batch = reader.next_batch().unwrap().unwrap();
// TODO: test the output
}
```
I was able to reproduce the 0.0 values without your fix, and the correct
numbers with the fix.
----------------------------------------------------------------
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]