Skip to content

Commit

Permalink
ARROW-8225: [Rust] Continuation marker check was in wrong location.
Browse files Browse the repository at this point in the history
In the previous commit I had the continuation marker check in the wrong location.

Closes #6791 from maxburke/rust_continuation_2

Authored-by: Max Burke <max@urbanlogiq.com>
Signed-off-by: Neville Dipale <nevilledips@gmail.com>
  • Loading branch information
maxburke authored and nevi-me committed Apr 3, 2020
1 parent 502e6fe commit 585ce8d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions rust/arrow/src/ipc/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,17 +727,22 @@ impl<R: Read> StreamReader<R> {
// determine metadata length
let mut meta_size: [u8; 4] = [0; 4];
reader.read_exact(&mut meta_size)?;
let meta_len = u32::from_le_bytes(meta_size);
let meta_len = {
let meta_len = u32::from_le_bytes(meta_size);

// If a continuation marker is encountered, skip over it and read
// the size from the next four bytes.
if meta_len == CONTINUATION_MARKER {
reader.read_exact(&mut meta_size)?;
u32::from_le_bytes(meta_size)
} else {
meta_len
}
};

let mut meta_buffer = vec![0; meta_len as usize];
reader.read_exact(&mut meta_buffer)?;

// If a continuation marker is encountered, skip over it and read
// the size from the next four bytes.
if u32::from_le_bytes(meta_size) == CONTINUATION_MARKER {
reader.read_exact(&mut meta_size)?;
}

let vecs = &meta_buffer.to_vec();
let message = ipc::get_root_as_message(vecs);
// message header is a Schema, so read it
Expand Down

0 comments on commit 585ce8d

Please sign in to comment.