kangkaisen commented on a change in pull request #2319: Add Bitmap index reader
URL: https://github.com/apache/incubator-doris/pull/2319#discussion_r352555474
 
 

 ##########
 File path: be/src/olap/rowset/segment_v2/index_page.cpp
 ##########
 @@ -67,57 +68,63 @@ Status IndexPageBuilder::get_first_key(Slice* key) const {
 
 ///////////////////////////////////////////////////////////////////////////////
 
-IndexPageReader::IndexPageReader() : _parsed(false) {
-}
-
 Status IndexPageReader::parse(const Slice& data) {
-    return Status(); // FIXME
-}
-
-size_t IndexPageReader::count() const {
-    CHECK(_parsed) << "not parsed";
-    return _footer.num_entries();
-}
+    size_t buffer_len = data.size;
+    const uint8_t* buffer = (uint8_t*)data.data;
+    size_t footer_size = decode_fixed32_le(buffer + buffer_len - 4);
+    std::string footer_buf(data.data + buffer_len - 4 - footer_size, 
footer_size);
+    _footer.ParseFromString(footer_buf);
+    size_t num_entries = _footer.num_entries();
+    size_t entry_offset_start = buffer_len - 4 - footer_size - num_entries * 4;
+    for(size_t i = 0; i < num_entries; i++) {
+        size_t entry_offset = decode_fixed32_le(buffer + entry_offset_start);
+        _entry_offsets.push_back(entry_offset);
 
 Review comment:
   Has removed the entry_offsets from index_page.

----------------------------------------------------------------
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]

Reply via email to