Skip to content

Commit

Permalink
Use LE version of unalignedStore.
Browse files Browse the repository at this point in the history
  • Loading branch information
kothiga committed Sep 22, 2023
1 parent 80d5110 commit 3e57b00
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/Processors/Formats/Impl/BSONEachRowRowInputFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1045,13 +1045,7 @@ fileSegmentationEngineBSONEachRow(ReadBuffer & in, DB::Memory<> & memory, size_t

size_t old_size = memory.size();
memory.resize(old_size + document_size);

// Ensure the document size we write to the memory is byte arranged for LE.
BSONSizeT size_out = document_size;
if constexpr(std::endian::native == std::endian::big)
size_out = std::byteswap(size_out);
unalignedStore<BSONSizeT>(memory.data() + old_size, size_out);

unalignedStoreLittleEndian<BSONSizeT>(memory.data() + old_size, document_size);
in.readStrict(memory.data() + old_size + sizeof(document_size), document_size - sizeof(document_size));
++number_of_rows;
}
Expand Down

0 comments on commit 3e57b00

Please sign in to comment.