kangkaisen commented on a change in pull request #2319: Add Bitmap index reader
URL: https://github.com/apache/incubator-doris/pull/2319#discussion_r352555625
##########
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);
+ size_t num_to_read = 1;
+ ColumnBlock block(get_type_info(OLAP_FIELD_TYPE_VARCHAR), (uint8_t*)
&value, &nullmap, num_to_read, &mem_pool);
Review comment:
done
----------------------------------------------------------------
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]