gaodayue commented on a change in pull request #1694: optimize V2
BinaryPlainPage format (#1648)
URL: https://github.com/apache/incubator-doris/pull/1694#discussion_r317458003
##########
File path: be/src/olap/rowset/segment_v2/binary_plain_page.h
##########
@@ -222,39 +194,26 @@ class BinaryPlainPageDecoder : public PageDecoder {
}
Slice string_at_index(size_t idx) const {
- const uint32_t str_offset = offset(idx);
- uint32_t len = offset(idx + 1) - str_offset;
+ const uint32_t str_offset = idx == 0 ? 0 : offset(idx - 1);
+ uint32_t len = offset(idx) - str_offset;
return Slice(&_data[str_offset], len);
}
- // Minimum length of a header.
- static const size_t MIN_HEADER_SIZE = sizeof(uint32_t) * 2;
private:
// Return the offset within '_data' where the string value with index
'idx' can be found.
uint32_t offset(int idx) const {
Review comment:
```
if (idx >= _num_elems) {
return offsets_pos;
}
```
----------------------------------------------------------------
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]