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

 ##########
 File path: be/src/olap/rowset/segment_v2/bitmap_index_reader.cpp
 ##########
 @@ -17,10 +17,65 @@
 
 #include "olap/rowset/segment_v2/bitmap_index_reader.h"
 
+#include "olap/types.h"
+#include "runtime/mem_tracker.h"
+#include "runtime/mem_pool.h"
+
 namespace doris {
 namespace segment_v2 {
 
+Status BitmapIndexReader::load() {
+    const IndexedColumnMetaPB dict_meta = _bitmap_index_meta.dict_column();
+    const IndexedColumnMetaPB bitmap_meta = _bitmap_index_meta.bitmap_column();
+    _has_null = _bitmap_index_meta.has_null();
+
+    _dict_column_reader.reset(new IndexedColumnReader(_file, dict_meta));
+    _bitmap_column_reader.reset(new IndexedColumnReader(_file, bitmap_meta));
+    RETURN_IF_ERROR(_dict_column_reader->load());
+    RETURN_IF_ERROR(_bitmap_column_reader->load());
+    return Status::OK();
+}
+
+Status BitmapIndexReader::new_iterator(BitmapIndexIterator** iterator) {
+    *iterator = new BitmapIndexIterator(this);
+    return Status::OK();
+}
+
+Status BitmapIndexIterator::seek_dictionary(const void* value, bool* 
exact_match) {
+    RETURN_IF_ERROR(_dict_column_iter.seek_at_or_after(value, exact_match));
+    _current_rowid = _dict_column_iter.get_current_ordinal();
+    return Status::OK();
+}
+
+Status BitmapIndexIterator::read_bitmap(rowid_t ordinal, Roaring* result) {
+    DCHECK(0 <= ordinal && ordinal < _reader->bitmap_nums());
+
+    Slice value;
+    uint8_t nullmap;
+    MemTracker mem_tracker;
+    MemPool mem_pool(&mem_tracker);
 
 Review comment:
   make it as member to avoid allocate and deallocate each time.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to