You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@doris.apache.org by GitBox <gi...@apache.org> on 2019/08/28 14:40:17 UTC

[GitHub] [incubator-doris] imay commented on a change in pull request #1718: Basic implementation for BetaRowsetReader

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

 ##########
 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:
   I think we can add a property in rowset meta. This property will tell if all segments is sorted because  we know it when generate rowset. When the rowset is generated by compaction, all segments is sorted. If the rowset is generated by load, segments are unsorted.
   
   We should only use create merge iterator for unsorted segments when  need_ordered_result is true.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@doris.apache.org
For additional commands, e-mail: dev-help@doris.apache.org