wangbo commented on a change in pull request #1694: optimize V2 BinaryPlainPage
format (#1648)
URL: https://github.com/apache/incubator-doris/pull/1694#discussion_r317058442
##########
File path: be/src/olap/rowset/segment_v2/binary_plain_page.h
##########
@@ -80,24 +80,21 @@ class BinaryPlainPageBuilder : public PageBuilder {
Slice finish() override {
_finished = true;
- size_t offsets_pos = _buffer.size();
-
- // Set up the header
- encode_fixed32_le(&_buffer[0], _offsets.size());
- encode_fixed32_le(&_buffer[4], offsets_pos);
+ // Set up trailer
+ size_t new_cap = _buffer.size() + _offsets.size() * sizeof(uint32_t) +
MAX_TRAILER_SIZE;
+ if (new_cap > _buffer.capacity())
+ _buffer.GrowArray(new_cap);
_buffer.append(&_offsets[0], _offsets.size() * sizeof(uint32_t));
Review comment:
I find that put_fixed32_le use encode_fixed32_le to write value to tmp
buffer,and then append tmp buffer to dst.
And encode_fixed32_le contains the logic which judges the byte order and
adjust the byte order of buffer,So I don't understand why using
encode_fixed32_le will cause " it doesn't write LE offset on big endian
platform"
I think the difference between encode_fixed32_le and put_fixed32_le is that
caller doesn't need init a tmp buffer when calling put_fixed32_le
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]