Skip to content

Commit

Permalink
ARROW-8747: [C++] Write compressed size in little-endian format for F…
Browse files Browse the repository at this point in the history
…eather V2

This PR always puts the compressed size in little-endian format for Feather V2 since the reader expected the little-endian format.

Based on [the discussion](#6777 (comment)) at #6777, [this commit](aa28280) reads compressed_length in Feather V2 format as little-endian. However, the writer [puts compressed_length in native-endian](https://github.com/apache/arrow/blob/master/cpp/src/arrow/ipc/writer.cc#L177).

This PR can fix failures related to reading compressed feather format in `arrow-ipc-read-write-test` and `arrow-feather-test`.

Closes #7137 from kiszk/ARROW-8747

Authored-by: Kazuaki Ishizaki <ishizaki@jp.ibm.com>
Signed-off-by: Wes McKinney <wesm+git@apache.org>
  • Loading branch information
kiszk authored and wesm committed May 9, 2020
1 parent 3567dcf commit 80d031f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cpp/src/arrow/ipc/writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ class RecordBatchSerializer {
ARROW_ASSIGN_OR_RAISE(actual_length,
codec->Compress(buffer.size(), buffer.data(), maximum_length,
result->mutable_data() + sizeof(int64_t)));
*reinterpret_cast<int64_t*>(result->mutable_data()) = buffer.size();
*reinterpret_cast<int64_t*>(result->mutable_data()) =
BitUtil::ToLittleEndian(buffer.size());
*out = SliceBuffer(std::move(result), /*offset=*/0, actual_length + sizeof(int64_t));
return Status::OK();
}
Expand Down

0 comments on commit 80d031f

Please sign in to comment.