gaodayue commented on a change in pull request #1718: Basic implementation for 
BetaRowsetReader
URL: https://github.com/apache/incubator-doris/pull/1718#discussion_r319745639
 
 

 ##########
 File path: be/src/olap/rowset/beta_rowset_reader.cpp
 ##########
 @@ -0,0 +1,111 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "beta_rowset_reader.h"
+
+#include "olap/generic_iterators.h"
+#include "olap/row_block.h"
+#include "olap/row_block2.h"
+#include "olap/row_cursor.h"
+#include "olap/rowset/segment_v2/segment_iterator.h"
+#include "olap/schema.h"
+
+namespace doris {
+
+BetaRowsetReader::BetaRowsetReader(BetaRowsetSharedPtr rowset)
+    : _rowset(std::move(rowset)) {
+}
+
+OLAPStatus BetaRowsetReader::init(RowsetReaderContext* read_context) {
+    _context = read_context;
+
+    Schema schema(_context->tablet_schema->columns(), 
*(_context->seek_columns));
+
+    // convert RowsetReaderContext to StorageReadOptions
+    StorageReadOptions read_options;
+    read_options.conditions = read_context->conditions;
+    for (int i = 0; i < read_context->lower_bound_keys->size(); ++i) {
+        read_options.key_ranges.emplace_back(
+            read_context->lower_bound_keys->at(i),
+            read_context->is_lower_keys_included->at(i),
+            read_context->upper_bound_keys->at(i),
+            read_context->is_upper_keys_included->at(i));
+    }
+
+    // create iterator for each segment
+    std::vector<std::unique_ptr<segment_v2::SegmentIterator>> seg_iterators;
+    for (auto& seg_ptr : _rowset->_segments) {
+        seg_iterators.push_back(seg_ptr->new_iterator(schema, read_options));
+    }
+    std::vector<RowwiseIterator*> iterators;
+    for (auto& owned_it : seg_iterators) {
+        // transfer ownership of segment iterator to `_iterator`
+        iterators.push_back(owned_it.release());
+    }
+
+    // merge or union segment iterator
 
 Review comment:
   Since adding the ordering property affects both apha and beta rowset, I will 
do this in a separate PR.

----------------------------------------------------------------
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: dev-unsubscr...@doris.apache.org
For additional commands, e-mail: dev-h...@doris.apache.org

Reply via email to