You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "mrhhsg (via GitHub)" <gi...@apache.org> on 2023/12/07 03:22:11 UTC
[PR] [feature](scan) parallel scan on dup/mow mode [doris]
mrhhsg opened a new pull request, #28103:
URL: https://github.com/apache/doris/pull/28103
## Proposed changes
Issue Number: close #xxx
<!--Describe your changes.-->
## Further comments
If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "jacktengg (via GitHub)" <gi...@apache.org>.
jacktengg commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1430860893
##########
be/src/olap/parallel_scanner_builder.h:
##########
@@ -0,0 +1,120 @@
+// 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.
+
+#pragma once
+
+#include <memory>
+#include <string>
+#include <utility>
+
+#include "olap/reader.h"
+#include "olap/rowset/segment_v2/row_ranges.h"
+#include "olap/segment_loader.h"
+#include "olap/tablet.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
+namespace vectorized {
+class VScanner;
+}
+
+using TabletSPtr = std::shared_ptr<Tablet>;
+using VScannerSPtr = std::shared_ptr<vectorized::VScanner>;
+
+struct TabletWithVersion {
+ TabletSPtr tablet;
+ int64_t version;
+};
+
+struct SegmentGroup {
Review Comment:
Please add comment
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "mrhhsg (via GitHub)" <gi...@apache.org>.
mrhhsg commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1857920087
run buildall
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1858806871
TPC-H test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
```
Tpch sf100 test result on commit 319eed7fea479019a2225f3e557173f4ef9b57cf, data reload: false
run tpch-sf100 query with default conf and session variables
q1 4733 4467 4455 4455
q2 364 148 147 147
q3 1439 1285 1220 1220
q4 1108 906 918 906
q5 3118 3178 3141 3141
q6 243 127 129 127
q7 1001 482 482 482
q8 2231 2218 2192 2192
q9 6705 6645 6652 6645
q10 3203 3285 3241 3241
q11 328 202 210 202
q12 350 205 206 205
q13 4585 3811 3766 3766
q14 236 212 211 211
q15 560 520 532 520
q16 442 394 386 386
q17 1021 621 590 590
q18 7176 6922 6856 6856
q19 1542 1434 1374 1374
q20 545 297 298 297
q21 3037 2603 2659 2603
q22 345 279 279 279
Total cold run time: 44312 ms
Total hot run time: 39845 ms
run tpch-sf100 query with default conf and set session variable runtime_filter_mode=off
q1 4410 4410 4373 4373
q2 267 162 169 162
q3 3525 3521 3522 3521
q4 2382 2370 2355 2355
q5 5712 5714 5733 5714
q6 243 119 120 119
q7 2393 1842 1875 1842
q8 3520 3530 3503 3503
q9 9071 8982 9055 8982
q10 3877 3995 3968 3968
q11 501 384 384 384
q12 755 601 592 592
q13 4324 3594 3568 3568
q14 299 248 260 248
q15 573 531 524 524
q16 508 458 460 458
q17 1877 1875 1853 1853
q18 8727 8267 8227 8227
q19 1744 1720 1753 1720
q20 2266 1961 1953 1953
q21 6503 6141 6133 6133
q22 518 414 407 407
Total cold run time: 63995 ms
Total hot run time: 60606 ms
```
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "mrhhsg (via GitHub)" <gi...@apache.org>.
mrhhsg commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1857352696
run buildall
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "mrhhsg (via GitHub)" <gi...@apache.org>.
mrhhsg commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1859466597
run clickbench
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1859493813
TPC-H test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
```
Tpch sf100 test result on commit c539c9ccbd945621fac57f8a72d9ee1a37c3f4ee, data reload: false
run tpch-sf100 query with default conf and session variables
q1 4738 4521 4501 4501
q2 362 160 157 157
q3 1450 1242 1237 1237
q4 1115 920 917 917
q5 3120 3112 3178 3112
q6 248 128 125 125
q7 1004 495 488 488
q8 2236 2196 2181 2181
q9 6695 6639 6650 6639
q10 3225 3261 3240 3240
q11 320 207 203 203
q12 355 208 210 208
q13 4596 3802 3793 3793
q14 239 210 216 210
q15 567 521 515 515
q16 439 382 389 382
q17 1020 594 527 527
q18 7143 7035 7121 7035
q19 1537 1434 1441 1434
q20 544 316 284 284
q21 3073 2615 2667 2615
q22 348 275 288 275
Total cold run time: 44374 ms
Total hot run time: 40078 ms
run tpch-sf100 query with default conf and set session variable runtime_filter_mode=off
q1 4411 4404 4416 4404
q2 269 160 168 160
q3 3534 3531 3531 3531
q4 2387 2362 2366 2362
q5 5737 5731 5745 5731
q6 243 123 120 120
q7 2413 1859 1870 1859
q8 3525 3519 3523 3519
q9 9065 9030 8992 8992
q10 3924 4002 3990 3990
q11 505 378 397 378
q12 760 587 590 587
q13 4299 3539 3551 3539
q14 279 245 270 245
q15 566 522 525 522
q16 501 486 455 455
q17 1885 1862 1858 1858
q18 8742 8272 8289 8272
q19 1718 1785 1773 1773
q20 2279 1941 1932 1932
q21 6556 6207 6163 6163
q22 498 411 425 411
Total cold run time: 64096 ms
Total hot run time: 60803 ms
```
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1428755873
##########
be/src/olap/parallel_scanner_builder.cpp:
##########
@@ -0,0 +1,455 @@
+// 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 "parallel_scanner_builder.h"
+
+#include "exec/olap_utils.h"
+#include "olap/iterators.h"
+#include "olap/primary_key_index.h"
+#include "olap/row_cursor.h"
+#include "olap/rowset/beta_rowset.h"
+#include "olap/rowset/segment_v2/segment.h"
+#include "olap/short_key_index.h"
+#include "util/key_util.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
+using namespace vectorized;
+
+using SplitKey = StorageReadOptions::SplitKey;
+using SplitKeyRange = StorageReadOptions::SplitKeyRange;
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::build_scanners(std::list<VScannerSPtr>& scanners) {
+ RETURN_IF_ERROR(_load());
+ if (_is_dup_mow_key) {
+ return _build_scanners_by_rowid(scanners);
+ } else {
+ return _build_scanners_by_key_range(scanners);
+ }
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
+ std::list<VScannerSPtr>& scanners) {
+ DCHECK_GE(_rows_per_scanners, _min_rows_per_scanner);
+ for (auto&& [tablet, version] : _tablets) {
+ DCHECK(_all_rowsets.contains(tablet->tablet_id()));
+ auto& rowsets = _all_rowsets[tablet->tablet_id()];
+
+ TabletReader::ReadSource reade_source_with_delete_info;
+ if (!_state->skip_delete_predicate()) {
+ RETURN_IF_ERROR(tablet->capture_rs_readers(
+ {0, version}, &reade_source_with_delete_info.rs_splits, false));
+ reade_source_with_delete_info.fill_delete_predicates();
+ }
+
+ TabletReader::ReadSource read_source;
+
+ int64_t rows_collected = 0;
+ for (auto& rowset : rowsets) {
+ auto beta_rowset = std::dynamic_pointer_cast<BetaRowset>(rowset);
+ RowsetReaderSharedPtr reader;
+ RETURN_IF_ERROR(beta_rowset->create_reader(&reader));
+ const auto rowset_id = beta_rowset->rowset_id();
+
+ DCHECK(_segment_cache_handles.contains(rowset_id));
+ auto& segment_cache_handle = _segment_cache_handles[rowset_id];
+
+ if (beta_rowset->num_rows() == 0) {
+ continue;
+ }
+
+ const auto& segments = segment_cache_handle.get_segments();
+ int segment_start = 0;
+ auto split = RowSetSplits(reader->clone());
+
+ for (size_t i = 0; i != segments.size(); ++i) {
+ const auto& segment = segments[i];
+ RowRanges row_ranges;
+ const size_t rows_of_segment = segment->num_rows();
+ int64_t offset_in_segment = 0;
+
+ while (offset_in_segment < rows_of_segment) {
+ const int64_t remaining_rows = rows_of_segment - offset_in_segment;
+ auto rows_need = _rows_per_scanners - rows_collected;
+ if (rows_need >= remaining_rows * 0.9) {
+ rows_need = remaining_rows;
+ }
+ DCHECK_LE(rows_need, remaining_rows);
+
+ auto old_count = row_ranges.count();
+ row_ranges.add({offset_in_segment,
+ offset_in_segment + static_cast<int64_t>(rows_need)});
+ DCHECK_EQ(rows_need + old_count, row_ranges.count());
+ rows_collected += rows_need;
+ offset_in_segment += rows_need;
+
+ if (rows_collected >= _rows_per_scanners) { // build a new scanner
+ split.segment_offsets.first = segment_start,
+ split.segment_offsets.second = i + 1;
+ split.segment_row_ranges.emplace_back(std::move(row_ranges));
+
+ DCHECK_EQ(split.segment_offsets.second - split.segment_offsets.first,
+ split.segment_row_ranges.size());
+
+ read_source.rs_splits.emplace_back(std::move(split));
+
+ if (!_state->skip_delete_predicate()) {
+ read_source.fill_delete_predicates();
+ }
+
+ scanners.emplace_back(
+ _build_scanner(tablet, version, _key_ranges,
+ {std::move(read_source.rs_splits),
+ reade_source_with_delete_info.delete_predicates}));
+
+ read_source = TabletReader::ReadSource();
+ split = RowSetSplits(reader->clone());
+ row_ranges = RowRanges();
+
+ segment_start = offset_in_segment < rows_of_segment ? i : i + 1;
+ rows_collected = 0;
+ }
+ }
+
+ if (!row_ranges.is_empty()) {
+ DCHECK_GT(rows_collected, 0);
+ DCHECK_EQ(row_ranges.to(), segment->num_rows());
+ split.segment_row_ranges.emplace_back(std::move(row_ranges));
+ }
+ }
+
+ DCHECK_LE(rows_collected, _rows_per_scanners);
+ if (rows_collected > 0) {
+ split.segment_offsets.first = segment_start;
+ split.segment_offsets.second = segments.size();
+ DCHECK_GT(split.segment_offsets.second, split.segment_offsets.first);
+ DCHECK_EQ(split.segment_row_ranges.size(),
+ split.segment_offsets.second - split.segment_offsets.first);
+ read_source.rs_splits.emplace_back(std::move(split));
+ }
+ } // end `for (auto& rowset : rowsets)`
+
+ DCHECK_LE(rows_collected, _rows_per_scanners);
+ if (rows_collected > 0) {
+ DCHECK_GT(read_source.rs_splits.size(), 0);
+#ifndef NDEBUG
+ for (auto& split : read_source.rs_splits) {
+ DCHECK(split.rs_reader != nullptr);
+ DCHECK_LT(split.segment_offsets.first, split.segment_offsets.second);
+ DCHECK_EQ(split.segment_row_ranges.size(),
+ split.segment_offsets.second - split.segment_offsets.first);
+ }
+#endif
+ scanners.emplace_back(
+ _build_scanner(tablet, version, _key_ranges,
+ {std::move(read_source.rs_splits),
+ reade_source_with_delete_info.delete_predicates}));
+ }
+ }
+
+ return Status::OK();
+}
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_load() {
+ for (auto&& [tablet, version] : _tablets) {
+ const auto tablet_id = tablet->tablet_id();
+ auto& rows = _tablets_rows.emplace_back(0);
+ auto& rowsets = _all_rowsets[tablet_id];
+ RETURN_IF_ERROR(tablet->capture_consistent_rowsets({0, version}, &rowsets));
+
+ for (auto& rowset : rowsets) {
+ RETURN_IF_ERROR(rowset->load());
+ const auto rowset_id = rowset->rowset_id();
+ auto& segment_cache_handle = _segment_cache_handles[rowset_id];
+
+ RETURN_IF_ERROR(SegmentLoader::instance()->load_segments(
+ std::dynamic_pointer_cast<BetaRowset>(rowset), &segment_cache_handle, true));
+ _total_rows += rowset->num_rows();
+ rows += _total_rows;
+ }
+ }
+
+ _rows_per_scanners = _total_rows / _max_scanners_count;
+ _rows_per_scanners = std::max<size_t>(_rows_per_scanners, _min_rows_per_scanner);
+
+ return Status::OK();
+}
+
+template <typename ParentType>
+std::unique_ptr<SegmentGroup>
+ParallelScannerBuilder<ParentType>::_create_segment_group_from_rowsets(
+ const std::vector<RowsetSharedPtr>& rowsets) {
+ if (rowsets.empty()) {
+ return {};
+ }
+
+ size_t max_rows = 0;
+ auto segment_group = std::make_unique<SegmentGroup>();
+ for (const auto& rowset : rowsets) {
+ const auto rowset_id = rowset->rowset_id();
+ DCHECK(_segment_cache_handles.contains(rowset_id));
+ auto& cache_handle = _segment_cache_handles[rowset_id];
+ auto& segments = cache_handle.get_segments();
+
+ if (segments.empty()) {
+ continue;
+ }
+
+ if (rowset->is_segments_overlapping()) {
+ auto* largest_segment = segments[0].get();
+ for (size_t i = 1; i != segments.size(); ++i) {
+ if (segments[i]->num_rows() > largest_segment->num_rows()) {
+ largest_segment = segments[i].get();
+ }
+ }
+
+ if (largest_segment->num_rows() > max_rows) {
+ segment_group->rowset = rowset;
+ segment_group->num_rows = largest_segment->num_rows();
+ segment_group->segments.clear();
+ segment_group->segments.emplace_back(largest_segment);
+ max_rows = largest_segment->num_rows();
+ }
+ } else if (rowset->num_rows() > max_rows) {
+ max_rows = rowset->num_rows();
+ segment_group->rowset = rowset;
+ segment_group->segments.clear();
+ segment_group->segments.reserve(segments.size());
+ segment_group->num_rows = 0;
+ for (auto& segment : segments) {
+ segment_group->num_rows += segment->num_rows();
+ segment_group->segments.emplace_back(segment.get());
+ }
+ }
+ }
+
+ if (max_rows == 0) {
+ return {};
+ }
+
+ DCHECK(segment_group->rowset != nullptr);
+ return segment_group;
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_parse_segment_group(SegmentGroup& group) {
+ for (auto* segment : group.segments) {
+ RETURN_IF_ERROR(segment->load_index());
+ const ShortKeyIndexDecoder* index = segment->get_short_key_index();
+ group.num_blocks += index->num_items();
+ }
+ return Status::OK();
+}
+
+template <typename ParentType>
+std::shared_ptr<NewOlapScanner> ParallelScannerBuilder<ParentType>::_build_scanner(
+ BaseTabletSPtr tablet, int64_t version, const std::vector<OlapScanRange*>& key_ranges,
+ TabletReader::ReadSource&& read_source) {
+ NewOlapScanner::Params params {
+ _state, _scanner_profile.get(), key_ranges, std::move(tablet),
+ version, std::move(read_source), _limit_per_scanner, _is_preaggregation};
+ return NewOlapScanner::create_shared(_parent, std::move(params));
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_convert_key_ranges(
+ const TabletSPtr& tablet, std::vector<std::string>& start_keys,
+ std::vector<std::string>& end_keys, std::vector<bool>& include_begin_keys,
+ std::vector<bool>& include_end_keys, std::shared_ptr<Schema>& schema) {
+ DCHECK(start_keys.empty());
+ DCHECK(end_keys.empty());
+
+ TabletSchemaSPtr tablet_schema = tablet->tablet_schema();
+
+ std::vector<uint32_t> columns;
+ if (_key_ranges.empty()) {
+ columns.resize(tablet->num_short_key_columns());
+ } else {
+ DCHECK_EQ(_key_ranges.front()->end_scan_range.size(),
+ _key_ranges.front()->begin_scan_range.size());
+ columns.resize(_key_ranges.front()->end_scan_range.size());
+ }
+
+ std::iota(columns.begin(), columns.end(), 0);
+ schema = std::make_shared<Schema>(tablet_schema->columns(), columns);
+
+ if (_key_ranges.empty()) {
+ start_keys.emplace_back();
+ end_keys.emplace_back();
+ include_begin_keys.emplace_back(true);
+ include_end_keys.emplace_back(true);
+ return Status::OK();
+ }
+
+ for (auto& key_range : _key_ranges) {
+ start_keys.emplace_back();
+ end_keys.emplace_back();
+
+ include_begin_keys.emplace_back(key_range->begin_include);
+ include_end_keys.emplace_back(key_range->end_include);
+
+ RowCursor start_key;
+ RowCursor end_key;
+ RETURN_IF_ERROR(start_key.init_scan_key(tablet->tablet_schema(),
+ key_range->begin_scan_range.values(), schema));
+ RETURN_IF_ERROR(start_key.from_tuple(key_range->begin_scan_range));
+
+ encode_key_with_padding(&start_keys.back(), start_key,
+ tablet_schema->num_short_key_columns(), key_range->begin_include);
+
+ RETURN_IF_ERROR(end_key.init_scan_key(tablet->tablet_schema(),
+ key_range->end_scan_range.values(), schema));
+ RETURN_IF_ERROR(end_key.from_tuple(key_range->end_scan_range));
+
+ encode_key_with_padding(&end_keys.back(), end_key, tablet_schema->num_short_key_columns(),
+ !key_range->end_include);
+ }
+
+ return Status::OK();
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
Review Comment:
warning: function '_build_scanners_by_key_range' exceeds recommended size/complexity thresholds [readability-function-size]
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
^
```
<details>
<summary>Additional context</summary>
**be/src/olap/parallel_scanner_builder.cpp:328:** 121 lines including whitespace and comments (threshold 80)
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
^
```
</details>
##########
be/src/olap/parallel_scanner_builder.cpp:
##########
@@ -0,0 +1,455 @@
+// 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 "parallel_scanner_builder.h"
+
+#include "exec/olap_utils.h"
+#include "olap/iterators.h"
+#include "olap/primary_key_index.h"
+#include "olap/row_cursor.h"
+#include "olap/rowset/beta_rowset.h"
+#include "olap/rowset/segment_v2/segment.h"
+#include "olap/short_key_index.h"
+#include "util/key_util.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
+using namespace vectorized;
+
+using SplitKey = StorageReadOptions::SplitKey;
+using SplitKeyRange = StorageReadOptions::SplitKeyRange;
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::build_scanners(std::list<VScannerSPtr>& scanners) {
+ RETURN_IF_ERROR(_load());
+ if (_is_dup_mow_key) {
+ return _build_scanners_by_rowid(scanners);
+ } else {
+ return _build_scanners_by_key_range(scanners);
+ }
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
Review Comment:
warning: function '_build_scanners_by_rowid' exceeds recommended size/complexity thresholds [readability-function-size]
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
^
```
<details>
<summary>Additional context</summary>
**be/src/olap/parallel_scanner_builder.cpp:47:** 119 lines including whitespace and comments (threshold 80)
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
^
```
</details>
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1857784194
<details>
<summary>TPC-H test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'</summary>
```
Tpch sf100 test result on commit 852a33b61fa8cff9172981093e1dc4d0f8afd9b0, data reload: false
run tpch-sf100 query with default conf and session variables
q1 4703 4480 4461 4461
q2 377 158 158 158
q3 1454 1257 1281 1257
q4 1109 967 918 918
q5 3168 3219 3163 3163
q6 245 127 132 127
q7 993 496 492 492
q8 2221 2216 2192 2192
q9 6697 6672 6679 6672
q10 3239 3296 3297 3296
q11 325 203 203 203
q12 354 202 209 202
q13 4566 3822 3792 3792
q14 245 216 209 209
q15 564 533 532 532
q16 437 388 387 387
q17 1031 651 583 583
q18 7055 6855 6908 6855
q19 1554 1484 1369 1369
q20 521 311 319 311
q21 3087 2641 2655 2641
q22 346 278 278 278
Total cold run time: 44291 ms
Total hot run time: 40098 ms
run tpch-sf100 query with default conf and set session variable runtime_filter_mode=off
q1 4397 4349 4415 4349
q2 267 160 177 160
q3 3506 3500 3489 3489
q4 2396 2383 2371 2371
q5 5739 5734 5729 5729
q6 240 124 124 124
q7 2372 1857 1862 1857
q8 3506 3543 3532 3532
q9 9005 9003 8969 8969
q10 3941 4015 4026 4015
q11 512 381 378 378
q12 762 588 599 588
q13 4308 3531 3517 3517
q14 284 265 269 265
q15 573 540 522 522
q16 511 457 474 457
q17 1886 1890 1859 1859
q18 8617 8152 8068 8068
q19 1744 1757 1760 1757
q20 2253 1965 1938 1938
q21 6538 6139 6126 6126
q22 492 424 413 413
Total cold run time: 63849 ms
Total hot run time: 60483 ms
```
</details>
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "mrhhsg (via GitHub)" <gi...@apache.org>.
mrhhsg commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1865261664
run buildall
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1435902632
##########
be/src/vec/exec/scan/new_olap_scan_node.cpp:
##########
@@ -508,48 +503,103 @@ Status NewOlapScanNode::_init_scanners(std::list<VScannerSPtr>* scanners) {
std::vector<std::pair<BaseTabletSPtr, int64_t /* version */>> tablets_to_scan;
tablets_to_scan.reserve(_scan_ranges.size());
+ std::vector<TabletWithVersion> tablets;
+
for (auto&& scan_range : _scan_ranges) {
auto tablet = DORIS_TRY(ExecEnv::get_tablet(scan_range->tablet_id));
int64_t version = 0;
std::from_chars(scan_range->version.data(),
scan_range->version.data() + scan_range->version.size(), version);
+ tablets.emplace_back(
+ TabletWithVersion {std::dynamic_pointer_cast<Tablet>(tablet), version});
tablets_to_scan.emplace_back(std::move(tablet), version);
}
+ bool is_dup_mow_key = true;
+ bool unique_keys_with_mor = false;
+ bool enable_parallel_scan = _state->enable_parallel_scan();
+
// Split tablet segment by scanner, only use in pipeline in duplicate key
// 1. if tablet count lower than scanner thread num, count segment num of all tablet ready for scan
// TODO: some tablet may do not have segment, may need split segment all case
if (_shared_scan_opt && _scan_ranges.size() < config::doris_scanner_thread_pool_thread_num) {
Review Comment:
我想了想,我们还是不要让他跟shared scan 关联。
他可以作为一个独立的feature,这样测试感觉好测试。
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1427847772
##########
be/src/olap/iterators.h:
##########
@@ -69,10 +70,56 @@ class StorageReadOptions {
bool include_upper;
};
+ struct SplitKey {
+ std::string key;
+ std::shared_ptr<Schema> schema;
+ bool include;
+ };
+
+ struct SplitKeyRange {
+ SplitKeyRange() = default;
+
+ SplitKeyRange(SplitKey&& lower_key, SplitKey&& upper_key)
+ : lower_key(std::move(lower_key)), upper_key(std::move(upper_key)), valid(true) {}
+
+ SplitKeyRange(const SplitKeyRange&) = default;
+
+ SplitKeyRange(SplitKeyRange&& other) {
+ if (other.valid) {
+ lower_key = std::move(other.lower_key);
+ upper_key = std::move(other.upper_key);
+ }
+ valid = other.valid;
+ other.valid = false;
+ }
+
+ SplitKeyRange& operator=(const SplitKeyRange& other) = default;
+
+ SplitKeyRange& operator=(SplitKeyRange&& other) {
+ if (this != &other) {
+ lower_key = std::move(other.lower_key);
+ upper_key = std::move(other.upper_key);
+
+ valid = other.valid;
+ other.valid = false;
+ }
+ return *this;
+ }
+
+ // the lower bound of the range
Review Comment:
warning: method 'to_string' can be made static [readability-convert-member-functions-to-static]
```suggestion
[[nodiscard]] static std::string to_string() {
```
##########
be/src/olap/parallel_scanner_builder.cpp:
##########
@@ -0,0 +1,440 @@
+// 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 "parallel_scanner_builder.h"
+
+#include "exec/olap_utils.h"
+#include "olap/iterators.h"
+#include "olap/primary_key_index.h"
+#include "olap/row_cursor.h"
+#include "olap/rowset/beta_rowset.h"
+#include "olap/rowset/segment_v2/segment.h"
+#include "olap/short_key_index.h"
+#include "util/key_util.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
+using namespace vectorized;
+
+using SplitKey = StorageReadOptions::SplitKey;
+using SplitKeyRange = StorageReadOptions::SplitKeyRange;
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::build_scanners(std::list<VScannerSPtr>& scanners) {
+ RETURN_IF_ERROR(_load());
+ if (_is_dup_mow_key) {
+ return _build_scanners_by_rowid(scanners);
+ } else {
+ return _build_scanners_by_key_range(scanners);
+ }
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
Review Comment:
warning: function '_build_scanners_by_rowid' exceeds recommended size/complexity thresholds [readability-function-size]
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
^
```
<details>
<summary>Additional context</summary>
**be/src/olap/parallel_scanner_builder.cpp:47:** 104 lines including whitespace and comments (threshold 80)
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
^
```
</details>
##########
be/src/olap/parallel_scanner_builder.cpp:
##########
@@ -0,0 +1,440 @@
+// 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 "parallel_scanner_builder.h"
+
+#include "exec/olap_utils.h"
+#include "olap/iterators.h"
+#include "olap/primary_key_index.h"
+#include "olap/row_cursor.h"
+#include "olap/rowset/beta_rowset.h"
+#include "olap/rowset/segment_v2/segment.h"
+#include "olap/short_key_index.h"
+#include "util/key_util.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
+using namespace vectorized;
+
+using SplitKey = StorageReadOptions::SplitKey;
+using SplitKeyRange = StorageReadOptions::SplitKeyRange;
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::build_scanners(std::list<VScannerSPtr>& scanners) {
+ RETURN_IF_ERROR(_load());
+ if (_is_dup_mow_key) {
+ return _build_scanners_by_rowid(scanners);
+ } else {
+ return _build_scanners_by_key_range(scanners);
+ }
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
+ std::list<VScannerSPtr>& scanners) {
+ DCHECK_GE(_rows_per_scanners, _min_rows_per_scanner);
+ for (auto&& [tablet, version] : _tablets) {
+ DCHECK(_all_rowsets.contains(tablet->tablet_id()));
+ auto& rowsets = _all_rowsets[tablet->tablet_id()];
+
+ TabletReader::ReadSource read_source;
+
+ int64_t rows_collected = 0;
+ for (auto& rowset : rowsets) {
+ auto beta_rowset = std::dynamic_pointer_cast<BetaRowset>(rowset);
+ RowsetReaderSharedPtr reader;
+ RETURN_IF_ERROR(beta_rowset->create_reader(&reader));
+ const auto rowset_id = beta_rowset->rowset_id();
+
+ DCHECK(_segment_cache_handles.contains(rowset_id));
+ auto& segment_cache_handle = _segment_cache_handles[rowset_id];
+
+ if (beta_rowset->num_rows() == 0) {
+ continue;
+ }
+
+ const auto& segments = segment_cache_handle.get_segments();
+ int segment_start = 0;
+ auto split = RowSetSplits(reader->clone());
+
+ for (size_t i = 0; i != segments.size(); ++i) {
+ const auto& segment = segments[i];
+ RowRanges row_ranges;
+ const size_t rows_of_segment = segment->num_rows();
+ int64_t offset_in_segment = 0;
+
+ while (offset_in_segment < rows_of_segment) {
+ const int64_t remaining_rows = rows_of_segment - offset_in_segment;
+ auto rows_need = _rows_per_scanners - rows_collected;
+ if (rows_need >= remaining_rows * 0.9) {
+ rows_need = remaining_rows;
+ }
+ DCHECK_LE(rows_need, remaining_rows);
+
+ auto old_count = row_ranges.count();
+ row_ranges.add({offset_in_segment,
+ offset_in_segment + static_cast<int64_t>(rows_need)});
+ DCHECK_EQ(rows_need + old_count, row_ranges.count());
+ rows_collected += rows_need;
+ offset_in_segment += rows_need;
+
+ if (rows_collected >= _rows_per_scanners) { // build a new scanner
+ split.segment_offsets.first = segment_start,
+ split.segment_offsets.second = i + 1;
+ split.segment_row_ranges.emplace_back(std::move(row_ranges));
+
+ DCHECK_EQ(split.segment_offsets.second - split.segment_offsets.first,
+ split.segment_row_ranges.size());
+
+ read_source.rs_splits.emplace_back(std::move(split));
+
+ scanners.emplace_back(_build_scanner(tablet, version, _key_ranges,
+ std::move(read_source)));
+
+ read_source = TabletReader::ReadSource();
+ split = RowSetSplits(reader->clone());
+ row_ranges = RowRanges();
+
+ segment_start = offset_in_segment < rows_of_segment ? i : i + 1;
+ rows_collected = 0;
+ }
+ }
+
+ if (!row_ranges.is_empty()) {
+ DCHECK_GT(rows_collected, 0);
+ DCHECK_EQ(row_ranges.to(), segment->num_rows());
+ split.segment_row_ranges.emplace_back(std::move(row_ranges));
+ }
+ }
+
+ DCHECK_LE(rows_collected, _rows_per_scanners);
+ if (rows_collected > 0) {
+ split.segment_offsets.first = segment_start;
+ split.segment_offsets.second = segments.size();
+ DCHECK_GT(split.segment_offsets.second, split.segment_offsets.first);
+ DCHECK_EQ(split.segment_row_ranges.size(),
+ split.segment_offsets.second - split.segment_offsets.first);
+ read_source.rs_splits.emplace_back(std::move(split));
+ }
+ } // end `for (auto& rowset : rowsets)`
+
+ DCHECK_LE(rows_collected, _rows_per_scanners);
+ if (rows_collected > 0) {
+ DCHECK_GT(read_source.rs_splits.size(), 0);
+#ifndef NDEBUG
+ for (auto& split : read_source.rs_splits) {
+ DCHECK(split.rs_reader != nullptr);
+ DCHECK_LT(split.segment_offsets.first, split.segment_offsets.second);
+ DCHECK_EQ(split.segment_row_ranges.size(),
+ split.segment_offsets.second - split.segment_offsets.first);
+ }
+#endif
+ scanners.emplace_back(
+ _build_scanner(tablet, version, _key_ranges, std::move(read_source)));
+ }
+ }
+
+ return Status::OK();
+}
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_load() {
+ for (auto&& [tablet, version] : _tablets) {
+ const auto tablet_id = tablet->tablet_id();
+ auto& rows = _tablets_rows.emplace_back(0);
+ auto& rowsets = _all_rowsets[tablet_id];
+ RETURN_IF_ERROR(tablet->capture_consistent_rowsets({0, version}, &rowsets));
+
+ for (auto& rowset : rowsets) {
+ RETURN_IF_ERROR(rowset->load());
+ const auto rowset_id = rowset->rowset_id();
+ auto& segment_cache_handle = _segment_cache_handles[rowset_id];
+
+ RETURN_IF_ERROR(SegmentLoader::instance()->load_segments(
+ std::dynamic_pointer_cast<BetaRowset>(rowset), &segment_cache_handle, true));
+ _total_rows += rowset->num_rows();
+ rows += _total_rows;
+ }
+ }
+
+ _rows_per_scanners = _total_rows / _max_scanners_count;
+ _rows_per_scanners = std::max<size_t>(_rows_per_scanners, _min_rows_per_scanner);
+
+ return Status::OK();
+}
+
+template <typename ParentType>
+std::unique_ptr<SegmentGroup>
+ParallelScannerBuilder<ParentType>::_create_segment_group_from_rowsets(
+ const std::vector<RowsetSharedPtr>& rowsets) {
+ if (rowsets.empty()) {
+ return {};
+ }
+
+ size_t max_rows = 0;
+ auto segment_group = std::make_unique<SegmentGroup>();
+ for (const auto& rowset : rowsets) {
+ const auto rowset_id = rowset->rowset_id();
+ DCHECK(_segment_cache_handles.contains(rowset_id));
+ auto& cache_handle = _segment_cache_handles[rowset_id];
+ auto& segments = cache_handle.get_segments();
+
+ if (segments.empty()) {
+ continue;
+ }
+
+ if (rowset->is_segments_overlapping()) {
+ auto* largest_segment = segments[0].get();
+ for (size_t i = 1; i != segments.size(); ++i) {
+ if (segments[i]->num_rows() > largest_segment->num_rows()) {
+ largest_segment = segments[i].get();
+ }
+ }
+
+ if (largest_segment->num_rows() > max_rows) {
+ segment_group->rowset = rowset;
+ segment_group->num_rows = largest_segment->num_rows();
+ segment_group->segments.clear();
+ segment_group->segments.emplace_back(largest_segment);
+ max_rows = largest_segment->num_rows();
+ }
+ } else if (rowset->num_rows() > max_rows) {
+ max_rows = rowset->num_rows();
+ segment_group->rowset = rowset;
+ segment_group->segments.clear();
+ segment_group->segments.reserve(segments.size());
+ segment_group->num_rows = 0;
+ for (auto& segment : segments) {
+ segment_group->num_rows += segment->num_rows();
+ segment_group->segments.emplace_back(segment.get());
+ }
+ }
+ }
+
+ if (max_rows == 0) {
+ return {};
+ }
+
+ DCHECK(segment_group->rowset != nullptr);
+ return segment_group;
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_parse_segment_group(SegmentGroup& group) {
+ for (auto* segment : group.segments) {
+ RETURN_IF_ERROR(segment->load_index());
+ const ShortKeyIndexDecoder* index = segment->get_short_key_index();
+ group.num_blocks += index->num_items();
+ }
+ return Status::OK();
+}
+
+template <typename ParentType>
+std::shared_ptr<NewOlapScanner> ParallelScannerBuilder<ParentType>::_build_scanner(
+ BaseTabletSPtr tablet, int64_t version, const std::vector<OlapScanRange*>& key_ranges,
+ TabletReader::ReadSource&& read_source) {
+ NewOlapScanner::Params params {
+ _state, _scanner_profile.get(), key_ranges, std::move(tablet),
+ version, std::move(read_source), _limit_per_scanner, _is_preaggregation};
+ return NewOlapScanner::create_shared(_parent, std::move(params));
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_convert_key_ranges(
+ const TabletSPtr& tablet, std::vector<std::string>& start_keys,
+ std::vector<std::string>& end_keys, std::vector<bool>& include_begin_keys,
+ std::vector<bool>& include_end_keys, std::shared_ptr<Schema>& schema) {
+ DCHECK(start_keys.empty());
+ DCHECK(end_keys.empty());
+
+ TabletSchemaSPtr tablet_schema = tablet->tablet_schema();
+
+ std::vector<uint32_t> columns;
+ if (_key_ranges.empty()) {
+ columns.resize(tablet->num_short_key_columns());
+ } else {
+ DCHECK_EQ(_key_ranges.front()->end_scan_range.size(),
+ _key_ranges.front()->begin_scan_range.size());
+ columns.resize(_key_ranges.front()->end_scan_range.size());
+ }
+
+ std::iota(columns.begin(), columns.end(), 0);
+ schema = std::make_shared<Schema>(tablet_schema->columns(), columns);
+
+ if (_key_ranges.empty()) {
+ start_keys.emplace_back();
+ end_keys.emplace_back();
+ include_begin_keys.emplace_back(true);
+ include_end_keys.emplace_back(true);
+ return Status::OK();
+ }
+
+ for (auto& key_range : _key_ranges) {
+ start_keys.emplace_back();
+ end_keys.emplace_back();
+
+ include_begin_keys.emplace_back(key_range->begin_include);
+ include_end_keys.emplace_back(key_range->end_include);
+
+ RowCursor start_key;
+ RowCursor end_key;
+ RETURN_IF_ERROR(start_key.init_scan_key(tablet->tablet_schema(),
+ key_range->begin_scan_range.values(), schema));
+ RETURN_IF_ERROR(start_key.from_tuple(key_range->begin_scan_range));
+
+ encode_key_with_padding(&start_keys.back(), start_key,
+ tablet_schema->num_short_key_columns(), key_range->begin_include);
+
+ RETURN_IF_ERROR(end_key.init_scan_key(tablet->tablet_schema(),
+ key_range->end_scan_range.values(), schema));
+ RETURN_IF_ERROR(end_key.from_tuple(key_range->end_scan_range));
+
+ encode_key_with_padding(&end_keys.back(), end_key, tablet_schema->num_short_key_columns(),
+ !key_range->end_include);
+ }
+
+ return Status::OK();
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
Review Comment:
warning: function '_build_scanners_by_key_range' exceeds recommended size/complexity thresholds [readability-function-size]
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
^
```
<details>
<summary>Additional context</summary>
**be/src/olap/parallel_scanner_builder.cpp:313:** 121 lines including whitespace and comments (threshold 80)
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
^
```
</details>
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1844370773
(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 43.5 seconds
stream load tsv: 585 seconds loaded 74807831229 Bytes, about 121 MB/s
stream load json: 19 seconds loaded 2358488459 Bytes, about 118 MB/s
stream load orc: 66 seconds loaded 1101869774 Bytes, about 15 MB/s
stream load parquet: 34 seconds loaded 861443392 Bytes, about 24 MB/s
insert into select: 28.7 seconds inserted 10000000 Rows, about 348K ops/s
storage size: 17194784046 Bytes
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1862921349
(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 45.4 seconds
stream load tsv: 569 seconds loaded 74807831229 Bytes, about 125 MB/s
stream load json: 19 seconds loaded 2358488459 Bytes, about 118 MB/s
stream load orc: 66 seconds loaded 1101869774 Bytes, about 15 MB/s
stream load parquet: 32 seconds loaded 861443392 Bytes, about 25 MB/s
insert into select: 28.8 seconds inserted 10000000 Rows, about 347K ops/s
storage size: 17183775659 Bytes
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1435918560
##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -430,6 +456,53 @@ Status SegmentIterator::_get_row_ranges_by_keys() {
return Status::OK();
}
+Status SegmentIterator::_prepare_seek(const StorageReadOptions::SplitKeyRange& key_range) {
+ std::vector<const Field*> key_fields;
+ std::set<uint32_t> column_set;
+ for (auto cid : key_range.lower_key.schema->column_ids()) {
+ column_set.emplace(cid);
+ key_fields.emplace_back(key_range.lower_key.schema->column(cid));
+ }
+
+ for (auto cid : key_range.upper_key.schema->column_ids()) {
+ if (!column_set.contains(cid)) {
+ key_fields.emplace_back(key_range.upper_key.schema->column(cid));
+ column_set.emplace(cid);
+ }
+ }
+
+ if (!_seek_schema) {
+ _seek_schema = std::make_unique<Schema>(key_fields, key_fields.size());
+ }
+ // todo(wb) need refactor here, when using pk to search, _seek_block is useless
+ if (_seek_block.empty()) {
+ _seek_block.resize(_seek_schema->num_column_ids());
+ int i = 0;
+ for (auto cid : _seek_schema->column_ids()) {
+ const auto* column_desc = _seek_schema->column(cid);
+ _seek_block[i] = Schema::get_column_by_field(*column_desc);
+ i++;
+ }
+ }
+
+ // create used column iterator
+ for (auto cid : _seek_schema->column_ids()) {
+ if (_column_iterators[cid] == nullptr) {
+ RETURN_IF_ERROR(_segment->new_column_iterator(_opts.tablet_schema->column(cid),
+ &_column_iterators[cid], &_opts));
+ ColumnIteratorOptions iter_opts {
+ .use_page_cache = _opts.use_page_cache,
+ .file_reader = _file_reader.get(),
+ .stats = _opts.stats,
+ .io_ctx = _opts.io_ctx,
+ };
+ RETURN_IF_ERROR(_column_iterators[cid]->init(iter_opts));
+ }
+ }
+
+ return Status::OK();
+}
Review Comment:
parallel build
1. 拿到where 条件里的 key range
2. 我们对key range 拆分,拆分成多个, 此时 多个key range == 原来的key range。
3. key range 、 row range 下推到 rowset reader 和 segment iterator ---
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "mrhhsg (via GitHub)" <gi...@apache.org>.
mrhhsg commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1858773143
run buildall
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1435913025
##########
be/src/olap/rowset/beta_rowset_reader.cpp:
##########
@@ -237,10 +240,21 @@ Status BetaRowsetReader::get_segment_iterators(RowsetReaderContext* read_context
for (int i = seg_start; i < seg_end; i++) {
Review Comment:
segment rowid range
key range
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1859054310
TPC-H test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
```
Tpch sf100 test result on commit c539c9ccbd945621fac57f8a72d9ee1a37c3f4ee, data reload: false
run tpch-sf100 query with default conf and session variables
q1 4786 4448 4463 4448
q2 363 151 158 151
q3 1475 1252 1199 1199
q4 1118 907 927 907
q5 3119 3162 3168 3162
q6 245 131 126 126
q7 979 480 483 480
q8 2222 2220 2222 2220
q9 6678 6648 6677 6648
q10 3218 3292 3250 3250
q11 322 211 201 201
q12 348 210 210 210
q13 4589 3833 3801 3801
q14 244 209 218 209
q15 565 532 527 527
q16 445 387 385 385
q17 1039 691 563 563
q18 7213 6896 6976 6896
q19 1573 1445 1416 1416
q20 568 291 287 287
q21 3073 2765 2668 2668
q22 354 287 291 287
Total cold run time: 44536 ms
Total hot run time: 40041 ms
run tpch-sf100 query with default conf and set session variable runtime_filter_mode=off
q1 4396 4400 4374 4374
q2 270 164 171 164
q3 3531 3542 3523 3523
q4 2391 2385 2383 2383
q5 5736 5743 5741 5741
q6 240 122 119 119
q7 2388 1885 1879 1879
q8 3521 3524 3530 3524
q9 9041 8960 8995 8960
q10 3889 3984 3994 3984
q11 508 382 391 382
q12 773 589 619 589
q13 4277 3538 3562 3538
q14 285 250 268 250
q15 571 516 522 516
q16 505 457 442 442
q17 1855 1823 1851 1823
q18 8640 8311 8272 8272
q19 1756 1752 1747 1747
q20 2290 1946 1956 1946
q21 6529 6195 6158 6158
q22 494 425 431 425
Total cold run time: 63886 ms
Total hot run time: 60739 ms
```
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1859005606
TPC-H test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
```
Tpch sf100 test result on commit c539c9ccbd945621fac57f8a72d9ee1a37c3f4ee, data reload: false
run tpch-sf100 query with default conf and session variables
q1 4751 4476 4483 4476
q2 369 146 158 146
q3 1456 1258 1234 1234
q4 1108 919 922 919
q5 3141 3181 3152 3152
q6 250 128 125 125
q7 975 481 477 477
q8 2207 2224 2191 2191
q9 6704 6699 6669 6669
q10 3218 3273 3295 3273
q11 327 208 212 208
q12 353 205 210 205
q13 4588 3839 3831 3831
q14 244 210 215 210
q15 574 529 521 521
q16 434 391 388 388
q17 1014 569 518 518
q18 7178 6920 6887 6887
q19 1533 1430 1401 1401
q20 564 307 294 294
q21 3101 2654 2695 2654
q22 370 288 282 282
Total cold run time: 44459 ms
Total hot run time: 40061 ms
run tpch-sf100 query with default conf and set session variable runtime_filter_mode=off
q1 4429 4401 4400 4400
q2 268 165 172 165
q3 3540 3536 3531 3531
q4 2392 2379 2386 2379
q5 5760 5714 5731 5714
q6 243 120 119 119
q7 2392 1848 1908 1848
q8 3531 3535 3552 3535
q9 9071 9068 9019 9019
q10 3917 4004 4006 4004
q11 501 395 367 367
q12 769 603 594 594
q13 4292 3563 3596 3563
q14 290 254 266 254
q15 576 517 522 517
q16 515 443 477 443
q17 1887 1849 1830 1830
q18 8687 8153 8346 8153
q19 1746 1779 1762 1762
q20 2251 1959 1920 1920
q21 6541 6215 6205 6205
q22 521 445 419 419
Total cold run time: 64119 ms
Total hot run time: 60741 ms
```
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1859501581
(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 44.91 seconds
stream load tsv: 580 seconds loaded 74807831229 Bytes, about 123 MB/s
stream load json: 19 seconds loaded 2358488459 Bytes, about 118 MB/s
stream load orc: 67 seconds loaded 1101869774 Bytes, about 15 MB/s
stream load parquet: 32 seconds loaded 861443392 Bytes, about 25 MB/s
insert into select: 28.8 seconds inserted 10000000 Rows, about 347K ops/s
storage size: 17225773965 Bytes
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "mrhhsg (via GitHub)" <gi...@apache.org>.
mrhhsg commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1862755763
run buildall
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1864035250
PR approved by anyone and no changes requested.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1435909078
##########
be/src/vec/exec/scan/new_olap_scan_node.cpp:
##########
@@ -508,48 +503,103 @@ Status NewOlapScanNode::_init_scanners(std::list<VScannerSPtr>* scanners) {
std::vector<std::pair<BaseTabletSPtr, int64_t /* version */>> tablets_to_scan;
tablets_to_scan.reserve(_scan_ranges.size());
+ std::vector<TabletWithVersion> tablets;
+
for (auto&& scan_range : _scan_ranges) {
auto tablet = DORIS_TRY(ExecEnv::get_tablet(scan_range->tablet_id));
int64_t version = 0;
std::from_chars(scan_range->version.data(),
scan_range->version.data() + scan_range->version.size(), version);
+ tablets.emplace_back(
+ TabletWithVersion {std::dynamic_pointer_cast<Tablet>(tablet), version});
tablets_to_scan.emplace_back(std::move(tablet), version);
}
+ bool is_dup_mow_key = true;
+ bool unique_keys_with_mor = false;
+ bool enable_parallel_scan = _state->enable_parallel_scan();
+
// Split tablet segment by scanner, only use in pipeline in duplicate key
// 1. if tablet count lower than scanner thread num, count segment num of all tablet ready for scan
// TODO: some tablet may do not have segment, may need split segment all case
if (_shared_scan_opt && _scan_ranges.size() < config::doris_scanner_thread_pool_thread_num) {
for (auto&& [tablet, version] : tablets_to_scan) {
- is_dup_mow_key =
+ unique_keys_with_mor |= tablet->keys_type() == UNIQUE_KEYS &&
+ !tablet->enable_unique_key_merge_on_write();
+ is_dup_mow_key &=
tablet->keys_type() == DUP_KEYS || (tablet->keys_type() == UNIQUE_KEYS &&
tablet->enable_unique_key_merge_on_write());
- if (!is_dup_mow_key) {
- break;
- }
+ if (is_dup_mow_key) {
+ auto& read_source = tablets_read_source.emplace_back();
+ {
+ std::shared_lock rdlock(tablet->get_header_lock());
+ auto st =
+ tablet->capture_rs_readers({0, version}, &read_source.rs_splits, false);
+ if (!st.ok()) {
+ LOG(WARNING) << "fail to init reader.res=" << st;
+ return Status::InternalError(
+ "failed to initialize storage reader. tablet_id={} : {}",
+ tablet->tablet_id(), st.to_string());
+ }
+ }
+ if (!_state->skip_delete_predicate()) {
+ read_source.fill_delete_predicates();
+ }
- auto& read_source = tablets_read_source.emplace_back();
- {
- std::shared_lock rdlock(tablet->get_header_lock());
- auto st = tablet->capture_rs_readers({0, version}, &read_source.rs_splits, false);
- if (!st.ok()) {
- LOG(WARNING) << "fail to init reader.res=" << st;
- return Status::InternalError(
- "failed to initialize storage reader. tablet_id={} : {}",
- tablet->tablet_id(), st.to_string());
+ auto& rs_seg_count = tablet_rs_seg_count.emplace_back();
+ for (const auto& rowset_splits : read_source.rs_splits) {
+ auto num_segments = rowset_splits.rs_reader->rowset()->num_segments();
+ rs_seg_count.emplace_back(num_segments);
+ segment_count += num_segments;
}
}
- if (!_state->skip_delete_predicate()) {
- read_source.fill_delete_predicates();
- }
+ }
+ } else {
+ // To avoid each instance of ScanNode generating too many scanners,
+ // only enable parallel scan when `_shared_scan_opt` is true.
+ enable_parallel_scan = false;
+ is_dup_mow_key = false;
+ }
- auto& rs_seg_count = tablet_rs_seg_count.emplace_back();
- for (const auto& rowset_splits : read_source.rs_splits) {
- auto num_segments = rowset_splits.rs_reader->rowset()->num_segments();
- rs_seg_count.emplace_back(num_segments);
- segment_count += num_segments;
+ bool has_cpu_limit = _state->query_options().__isset.resource_limit &&
+ _state->query_options().resource_limit.__isset.cpu_limit;
Review Comment:
add comment here.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "mrhhsg (via GitHub)" <gi...@apache.org>.
mrhhsg closed pull request #28103: [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range.
URL: https://github.com/apache/doris/pull/28103
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1435914069
##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -392,35 +396,57 @@ Status SegmentIterator::_get_row_ranges_by_keys() {
DorisMetrics::instance()->segment_row_total->increment(num_rows());
// fast path for empty segment or empty key ranges
- if (_row_bitmap.isEmpty() || _opts.key_ranges.empty()) {
- return Status::OK();
- }
-
- // Read & seek key columns is a waste of time when no key column in _schema
- if (std::none_of(_schema->columns().begin(), _schema->columns().end(), [&](const Field* col) {
- return col && _opts.tablet_schema->column_by_uid(col->unique_id()).is_key();
- })) {
+ if (_row_bitmap.isEmpty() || (!_opts.split_key_range.valid && _opts.key_ranges.empty())) {
return Status::OK();
}
RowRanges result_ranges;
- for (auto& key_range : _opts.key_ranges) {
+ if (_opts.split_key_range.valid) {
Review Comment:
key range:
1. scan key keyrange
2. where short key ---> key range
add comment
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1857978591
<details>
<summary>TPC-H test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'</summary>
```
Tpch sf100 test result on commit c4a96d2a3ed4bda7219f7f0734b38aced8823155, data reload: false
run tpch-sf100 query with default conf and session variables
q1 4753 4426 4459 4426
q2 366 154 168 154
q3 1459 1247 1241 1241
q4 1121 906 882 882
q5 3197 3197 3215 3197
q6 246 132 129 129
q7 985 497 489 489
q8 2209 2214 2197 2197
q9 6728 6671 6626 6626
q10 3215 3294 3304 3294
q11 334 203 209 203
q12 351 206 210 206
q13 4527 3807 3816 3807
q14 242 209 221 209
q15 571 531 524 524
q16 451 381 387 381
q17 1025 637 650 637
q18 7164 6877 6766 6766
q19 1524 1451 1370 1370
q20 555 329 302 302
q21 3051 2715 2627 2627
q22 353 286 285 285
Total cold run time: 44427 ms
Total hot run time: 39952 ms
run tpch-sf100 query with default conf and set session variable runtime_filter_mode=off
q1 4391 4382 4415 4382
q2 268 162 175 162
q3 3532 3510 3493 3493
q4 2387 2373 2374 2373
q5 5756 5740 5734 5734
q6 238 125 123 123
q7 2359 1849 1852 1849
q8 3537 3526 3537 3526
q9 9027 9020 9049 9020
q10 3922 4016 4030 4016
q11 498 383 385 383
q12 771 590 599 590
q13 4293 3549 3554 3549
q14 286 243 260 243
q15 572 528 536 528
q16 536 468 455 455
q17 1898 1823 1870 1823
q18 8514 8146 8256 8146
q19 1735 1769 1746 1746
q20 2235 1942 1953 1942
q21 6492 6167 6154 6154
q22 494 411 442 411
Total cold run time: 63741 ms
Total hot run time: 60648 ms
```
</details>
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1862907486
TeamCity be ut coverage result:
Function Coverage: 36.47% (8537/23410)
Line Coverage: 28.57% (69382/242879)
Region Coverage: 27.60% (35915/130116)
Branch Coverage: 24.32% (18347/75438)
Coverage Report: http://coverage.selectdb-in.cc/coverage/51d7cdea073dc5fcda9c84d3d021fd00c1114029_51d7cdea073dc5fcda9c84d3d021fd00c1114029/report/index.html
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1864103711
TeamCity be ut coverage result:
Function Coverage: 36.46% (8538/23419)
Line Coverage: 28.56% (69418/243083)
Region Coverage: 27.60% (35930/130192)
Branch Coverage: 24.33% (18365/75488)
Coverage Report: http://coverage.selectdb-in.cc/coverage/57483d8fb9d5cb1a95ef817bc3bbcbee531108a0_57483d8fb9d5cb1a95ef817bc3bbcbee531108a0/report/index.html
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1865323767
(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 45.13 seconds
stream load tsv: 574 seconds loaded 74807831229 Bytes, about 124 MB/s
stream load json: 19 seconds loaded 2358488459 Bytes, about 118 MB/s
stream load orc: 67 seconds loaded 1101869774 Bytes, about 15 MB/s
stream load parquet: 32 seconds loaded 861443392 Bytes, about 25 MB/s
insert into select: 29.0 seconds inserted 10000000 Rows, about 344K ops/s
storage size: 17184123449 Bytes
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1857793075
(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 45.21 seconds
stream load tsv: 584 seconds loaded 74807831229 Bytes, about 122 MB/s
stream load json: 19 seconds loaded 2358488459 Bytes, about 118 MB/s
stream load orc: 66 seconds loaded 1101869774 Bytes, about 15 MB/s
stream load parquet: 33 seconds loaded 861443392 Bytes, about 24 MB/s
insert into select: 28.5 seconds inserted 10000000 Rows, about 350K ops/s
storage size: 17219624505 Bytes
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "mrhhsg (via GitHub)" <gi...@apache.org>.
mrhhsg commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1858800266
run buildall
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1863000748
TPC-H test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
```
Tpch sf100 test result on commit 51d7cdea073dc5fcda9c84d3d021fd00c1114029, data reload: false
run tpch-sf100 query with default conf and session variables
q1 4712 4408 4447 4408
q2 377 177 159 159
q3 1449 1245 1233 1233
q4 1106 925 864 864
q5 3162 3153 3139 3139
q6 268 128 129 128
q7 1006 486 489 486
q8 2195 2216 2209 2209
q9 6662 6672 6665 6665
q10 3228 3260 3287 3260
q11 312 180 185 180
q12 351 208 209 208
q13 4551 3776 3802 3776
q14 241 212 212 212
q15 569 532 524 524
q16 447 386 383 383
q17 999 593 617 593
q18 7125 6935 6968 6935
q19 1520 1334 1369 1334
q20 530 318 301 301
q21 3068 2638 2608 2608
q22 341 280 277 277
Total cold run time: 44219 ms
Total hot run time: 39882 ms
run tpch-sf100 query with default conf and set session variable runtime_filter_mode=off
q1 4337 4408 4369 4369
q2 265 162 172 162
q3 3536 3512 3506 3506
q4 2374 2369 2361 2361
q5 5724 5733 5744 5733
q6 238 120 121 120
q7 2366 1857 1879 1857
q8 3513 3517 3509 3509
q9 9010 9016 8984 8984
q10 3917 3991 4015 3991
q11 483 377 389 377
q12 760 603 599 599
q13 4287 3560 3553 3553
q14 281 251 259 251
q15 575 512 519 512
q16 522 451 463 451
q17 1877 1845 1834 1834
q18 8711 8258 8358 8258
q19 1751 1752 1731 1731
q20 2244 1933 1918 1918
q21 6547 6235 6191 6191
q22 492 423 424 423
Total cold run time: 63810 ms
Total hot run time: 60690 ms
```
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1435902181
##########
fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java:
##########
@@ -784,7 +792,19 @@ public class SessionVariable implements Serializable, Writable {
@VariableMgr.VarAttr(name = ENABLE_SHARED_SCAN, fuzzy = false, varType = VariableAnnotation.EXPERIMENTAL,
needForward = true)
- private boolean enableSharedScan = false;
+ private boolean enableSharedScan = true;
+
+ @VariableMgr.VarAttr(name = ENABLE_PARALLEL_SCAN, fuzzy = false, varType = VariableAnnotation.EXPERIMENTAL,
+ needForward = true)
+ private boolean enableParallelScan = true;
Review Comment:
这个也是默认值为false,默认不要开。
我们可以再流水线里开。
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1435913120
##########
be/src/olap/rowset/beta_rowset_reader.cpp:
##########
@@ -237,10 +240,21 @@ Status BetaRowsetReader::get_segment_iterators(RowsetReaderContext* read_context
for (int i = seg_start; i < seg_end; i++) {
auto& seg_ptr = segments[i];
std::unique_ptr<RowwiseIterator> iter;
- auto s = seg_ptr->new_iterator(_input_schema, _read_options, &iter);
- if (!s.ok()) {
- LOG(WARNING) << "failed to create iterator[" << seg_ptr->id() << "]: " << s.to_string();
- return Status::Error<ROWSET_READER_INIT>(s.to_string());
+ Status status;
Review Comment:
add comment
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1435913223
##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -380,6 +380,10 @@ Status SegmentIterator::_lazy_init() {
<< _opts.delete_bitmap.at(segment_id())->cardinality() << ", "
<< _opts.stats->rows_del_by_bitmap << " rows deleted by bitmap";
}
+
+ if (!_opts.row_ranges.is_empty()) {
Review Comment:
add comment
duplicate table, will set row range
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1844404288
<details>
<summary>TPC-H test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'</summary>
```
Tpch sf100 test result on commit 1f325db0f60237c849702a7040593a449c78bdc8, data reload: false
run tpch-sf100 query with default conf and session variables
q1 4741 4511 4441 4441
q2 373 142 156 142
q3 1466 1241 1227 1227
q4 1116 921 919 919
q5 3189 3146 3147 3146
q6 252 126 128 126
q7 994 497 493 493
q8 2198 2245 2193 2193
q9 6680 6710 6726 6710
q10 3186 3260 3270 3260
q11 324 210 214 210
q12 358 216 207 207
q13 4553 3832 3789 3789
q14 242 216 219 216
q15 561 525 524 524
q16 442 387 390 387
q17 1005 633 580 580
q18 7506 7449 6974 6974
q19 1513 1389 1406 1389
q20 524 322 335 322
q21 3124 2647 2665 2647
q22 356 289 286 286
Total cold run time: 44703 ms
Total hot run time: 40188 ms
run tpch-sf100 query with default conf and set session variable runtime_filter_mode=off
q1 4429 4381 4394 4381
q2 265 164 170 164
q3 3535 3525 3514 3514
q4 2364 2359 2363 2359
q5 5726 5725 5747 5725
q6 238 122 122 122
q7 2397 1847 1864 1847
q8 3528 3520 3534 3520
q9 9036 9034 9035 9034
q10 3889 3996 4005 3996
q11 494 384 380 380
q12 763 587 598 587
q13 4288 3565 3550 3550
q14 294 262 260 260
q15 573 509 521 509
q16 506 477 476 476
q17 1871 1843 1866 1843
q18 8631 8183 9475 8183
q19 1713 1764 1773 1764
q20 2266 1981 1950 1950
q21 6507 6212 6118 6118
q22 524 427 413 413
Total cold run time: 63837 ms
Total hot run time: 60695 ms
```
</details>
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1858785407
<details>
<summary>TPC-H test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'</summary>
```
Tpch sf100 test result on commit ce93b246e78f9bcfbb7175b55b14bb28ec1db2d4, data reload: false
run tpch-sf100 query with default conf and session variables
q1 4696 4425 4507 4425
q2 365 150 159 150
q3 1464 1243 1234 1234
q4 1103 932 866 866
q5 3169 3108 3170 3108
q6 249 130 130 130
q7 997 503 480 480
q8 2187 2202 2216 2202
q9 6708 6661 6645 6645
q10 3193 3269 3288 3269
q11 323 211 198 198
q12 354 205 211 205
q13 4562 3813 3824 3813
q14 243 218 212 212
q15 565 525 532 525
q16 437 384 384 384
q17 1004 586 576 576
q18 7066 6672 6772 6672
q19 1535 1423 1409 1409
q20 548 297 291 291
q21 3085 2627 2637 2627
q22 345 270 283 270
Total cold run time: 44198 ms
Total hot run time: 39691 ms
run tpch-sf100 query with default conf and set session variable runtime_filter_mode=off
q1 4406 4433 4399 4399
q2 266 169 180 169
q3 3497 3480 3486 3480
q4 2385 2362 2364 2362
q5 5710 5675 5680 5675
q6 240 118 122 118
q7 2347 1858 1866 1858
q8 3513 3518 3523 3518
q9 8970 8951 9028 8951
q10 3908 3997 4005 3997
q11 493 379 393 379
q12 761 618 588 588
q13 4291 3584 3565 3565
q14 297 252 254 252
q15 580 527 515 515
q16 520 452 465 452
q17 1899 1862 1825 1825
q18 8547 8109 7950 7950
q19 1724 1747 1756 1747
q20 2246 1948 1935 1935
q21 6514 6143 6150 6143
q22 482 421 413 413
Total cold run time: 63596 ms
Total hot run time: 60291 ms
```
</details>
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1858787877
(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 44.34 seconds
stream load tsv: 588 seconds loaded 74807831229 Bytes, about 121 MB/s
stream load json: 19 seconds loaded 2358488459 Bytes, about 118 MB/s
stream load orc: 67 seconds loaded 1101869774 Bytes, about 15 MB/s
stream load parquet: 32 seconds loaded 861443392 Bytes, about 25 MB/s
insert into select: 29.0 seconds inserted 10000000 Rows, about 344K ops/s
storage size: 17224221973 Bytes
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1859027699
TPC-H test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
```
Tpch sf100 test result on commit c539c9ccbd945621fac57f8a72d9ee1a37c3f4ee, data reload: false
run tpch-sf100 query with default conf and session variables
q1 4748 4459 4464 4459
q2 364 151 163 151
q3 1447 1235 1202 1202
q4 1116 876 903 876
q5 3160 3158 3225 3158
q6 249 129 127 127
q7 974 481 486 481
q8 2238 2244 2202 2202
q9 6705 6644 6704 6644
q10 3224 3280 3248 3248
q11 326 211 196 196
q12 350 208 214 208
q13 4532 3813 3806 3806
q14 239 214 212 212
q15 566 523 517 517
q16 437 383 396 383
q17 1033 686 593 593
q18 7204 7085 6883 6883
q19 1547 1467 1381 1381
q20 525 318 276 276
q21 3051 2642 2737 2642
q22 350 283 293 283
Total cold run time: 44385 ms
Total hot run time: 39928 ms
run tpch-sf100 query with default conf and set session variable runtime_filter_mode=off
q1 4450 4413 4424 4413
q2 270 162 172 162
q3 3541 3536 3507 3507
q4 2388 2368 2368 2368
q5 5730 5723 5738 5723
q6 244 122 122 122
q7 2377 1873 1865 1865
q8 3534 3529 3531 3529
q9 9068 9012 9068 9012
q10 3915 4025 3975 3975
q11 510 369 402 369
q12 773 591 614 591
q13 4283 3543 3568 3543
q14 283 257 253 253
q15 566 520 523 520
q16 515 452 456 452
q17 1868 1870 1853 1853
q18 8739 8236 8243 8236
q19 1735 1767 1719 1719
q20 2263 1948 1932 1932
q21 6542 6165 6172 6165
q22 526 439 433 433
Total cold run time: 64120 ms
Total hot run time: 60742 ms
```
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1431217707
##########
be/src/olap/parallel_scanner_builder.cpp:
##########
@@ -0,0 +1,472 @@
+// 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 "parallel_scanner_builder.h"
+
+#include "exec/olap_utils.h"
+#include "olap/iterators.h"
+#include "olap/primary_key_index.h"
+#include "olap/row_cursor.h"
+#include "olap/rowset/beta_rowset.h"
+#include "olap/rowset/segment_v2/segment.h"
+#include "olap/short_key_index.h"
+#include "util/key_util.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
+using namespace vectorized;
+
+using SplitKey = StorageReadOptions::SplitKey;
+using SplitKeyRange = StorageReadOptions::SplitKeyRange;
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::build_scanners(std::list<VScannerSPtr>& scanners) {
+ RETURN_IF_ERROR(_load());
+ if (_is_dup_mow_key) {
+ return _build_scanners_by_rowid(scanners);
+ } else {
+ return _build_scanners_by_key_range(scanners);
+ }
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
Review Comment:
warning: function '_build_scanners_by_rowid' exceeds recommended size/complexity thresholds [readability-function-size]
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
^
```
<details>
<summary>Additional context</summary>
**be/src/olap/parallel_scanner_builder.cpp:47:** 118 lines including whitespace and comments (threshold 80)
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
^
```
</details>
##########
be/src/olap/parallel_scanner_builder.h:
##########
@@ -0,0 +1,122 @@
+// 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.
+
+#pragma once
+
+#include <memory>
+#include <string>
+#include <utility>
+
+#include "olap/reader.h"
Review Comment:
warning: 'olap/reader.h' file not found [clang-diagnostic-error]
```cpp
#include "olap/reader.h"
^
```
##########
be/src/olap/parallel_scanner_builder.cpp:
##########
@@ -0,0 +1,472 @@
+// 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 "parallel_scanner_builder.h"
+
+#include "exec/olap_utils.h"
+#include "olap/iterators.h"
+#include "olap/primary_key_index.h"
+#include "olap/row_cursor.h"
+#include "olap/rowset/beta_rowset.h"
+#include "olap/rowset/segment_v2/segment.h"
+#include "olap/short_key_index.h"
+#include "util/key_util.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
+using namespace vectorized;
+
+using SplitKey = StorageReadOptions::SplitKey;
+using SplitKeyRange = StorageReadOptions::SplitKeyRange;
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::build_scanners(std::list<VScannerSPtr>& scanners) {
+ RETURN_IF_ERROR(_load());
+ if (_is_dup_mow_key) {
+ return _build_scanners_by_rowid(scanners);
+ } else {
+ return _build_scanners_by_key_range(scanners);
+ }
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
+ std::list<VScannerSPtr>& scanners) {
+ DCHECK_GE(_rows_per_scanners, _min_rows_per_scanner);
+ for (auto&& [tablet, version] : _tablets) {
+ DCHECK(_all_rowsets.contains(tablet->tablet_id()));
+ auto& rowsets = _all_rowsets[tablet->tablet_id()];
+
+ TabletReader::ReadSource reade_source_with_delete_info;
+ if (!_state->skip_delete_predicate()) {
+ RETURN_IF_ERROR(tablet->capture_rs_readers(
+ {0, version}, &reade_source_with_delete_info.rs_splits, false));
+ reade_source_with_delete_info.fill_delete_predicates();
+ }
+
+ TabletReader::ReadSource read_source;
+
+ int64_t rows_collected = 0;
+ for (auto& rowset : rowsets) {
+ auto beta_rowset = std::dynamic_pointer_cast<BetaRowset>(rowset);
+ RowsetReaderSharedPtr reader;
+ RETURN_IF_ERROR(beta_rowset->create_reader(&reader));
+ const auto rowset_id = beta_rowset->rowset_id();
+
+ DCHECK(_segment_cache_handles.contains(rowset_id));
+ auto& segment_cache_handle = _segment_cache_handles[rowset_id];
+
+ if (beta_rowset->num_rows() == 0) {
+ continue;
+ }
+
+ const auto& segments = segment_cache_handle.get_segments();
+ int segment_start = 0;
+ auto split = RowSetSplits(reader->clone());
+
+ for (size_t i = 0; i != segments.size(); ++i) {
+ const auto& segment = segments[i];
+ RowRanges row_ranges;
+ const size_t rows_of_segment = segment->num_rows();
+ int64_t offset_in_segment = 0;
+
+ // try to split large segments into RowRanges
+ while (offset_in_segment < rows_of_segment) {
+ const int64_t remaining_rows = rows_of_segment - offset_in_segment;
+ auto rows_need = _rows_per_scanners - rows_collected;
+
+ // 0.9: try to avoid splitting the segments into excessively small parts.
+ if (rows_need >= remaining_rows * 0.9) {
+ rows_need = remaining_rows;
+ }
+ DCHECK_LE(rows_need, remaining_rows);
+
+ row_ranges.add({offset_in_segment,
+ offset_in_segment + static_cast<int64_t>(rows_need)});
+ rows_collected += rows_need;
+ offset_in_segment += rows_need;
+
+ // If collected enough rows, build a new scanner
+ if (rows_collected >= _rows_per_scanners) {
+ split.segment_offsets.first = segment_start,
+ split.segment_offsets.second = i + 1;
+ split.segment_row_ranges.emplace_back(std::move(row_ranges));
+
+ DCHECK_EQ(split.segment_offsets.second - split.segment_offsets.first,
+ split.segment_row_ranges.size());
+
+ read_source.rs_splits.emplace_back(std::move(split));
+
+ scanners.emplace_back(
+ _build_scanner(tablet, version, _key_ranges,
+ {std::move(read_source.rs_splits),
+ reade_source_with_delete_info.delete_predicates}));
+
+ read_source = TabletReader::ReadSource();
+ split = RowSetSplits(reader->clone());
+ row_ranges = RowRanges();
+
+ segment_start = offset_in_segment < rows_of_segment ? i : i + 1;
+ rows_collected = 0;
+ }
+ }
+
+ // The non-empty `row_ranges` means there are some rows left in this segment not added into `split`.
+ if (!row_ranges.is_empty()) {
+ DCHECK_GT(rows_collected, 0);
+ DCHECK_EQ(row_ranges.to(), segment->num_rows());
+ split.segment_row_ranges.emplace_back(std::move(row_ranges));
+ }
+ }
+
+ DCHECK_LE(rows_collected, _rows_per_scanners);
+ if (rows_collected > 0) {
+ split.segment_offsets.first = segment_start;
+ split.segment_offsets.second = segments.size();
+ DCHECK_GT(split.segment_offsets.second, split.segment_offsets.first);
+ DCHECK_EQ(split.segment_row_ranges.size(),
+ split.segment_offsets.second - split.segment_offsets.first);
+ read_source.rs_splits.emplace_back(std::move(split));
+ }
+ } // end `for (auto& rowset : rowsets)`
+
+ DCHECK_LE(rows_collected, _rows_per_scanners);
+ if (rows_collected > 0) {
+ DCHECK_GT(read_source.rs_splits.size(), 0);
+#ifndef NDEBUG
+ for (auto& split : read_source.rs_splits) {
+ DCHECK(split.rs_reader != nullptr);
+ DCHECK_LT(split.segment_offsets.first, split.segment_offsets.second);
+ DCHECK_EQ(split.segment_row_ranges.size(),
+ split.segment_offsets.second - split.segment_offsets.first);
+ }
+#endif
+ scanners.emplace_back(
+ _build_scanner(tablet, version, _key_ranges,
+ {std::move(read_source.rs_splits),
+ reade_source_with_delete_info.delete_predicates}));
+ }
+ }
+
+ return Status::OK();
+}
+
+/**
+ * Load rowsets of each tablet with specified version, segments of each rowset.
+ */
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_load() {
+ for (auto&& [tablet, version] : _tablets) {
+ const auto tablet_id = tablet->tablet_id();
+ auto& rows = _tablets_rows.emplace_back(0);
+ auto& rowsets = _all_rowsets[tablet_id];
+ RETURN_IF_ERROR(tablet->capture_consistent_rowsets({0, version}, &rowsets));
+
+ for (auto& rowset : rowsets) {
+ RETURN_IF_ERROR(rowset->load());
+ const auto rowset_id = rowset->rowset_id();
+ auto& segment_cache_handle = _segment_cache_handles[rowset_id];
+
+ /// All loaded segments will be cached into segment_cache_handle.
+ RETURN_IF_ERROR(SegmentLoader::instance()->load_segments(
+ std::dynamic_pointer_cast<BetaRowset>(rowset), &segment_cache_handle, true));
+ _total_rows += rowset->num_rows();
+ rows += _total_rows;
+ }
+ }
+
+ _rows_per_scanners = _total_rows / _max_scanners_count;
+ _rows_per_scanners = std::max<size_t>(_rows_per_scanners, _min_rows_per_scanner);
+
+ return Status::OK();
+}
+
+template <typename ParentType>
+std::unique_ptr<SegmentGroup>
+ParallelScannerBuilder<ParentType>::_create_segment_group_from_rowsets(
+ const std::vector<RowsetSharedPtr>& rowsets) {
+ if (rowsets.empty()) {
+ return {};
+ }
+
+ size_t max_rows = 0;
+ auto segment_group = std::make_unique<SegmentGroup>();
+ for (const auto& rowset : rowsets) {
+ const auto rowset_id = rowset->rowset_id();
+ DCHECK(_segment_cache_handles.contains(rowset_id));
+ auto& cache_handle = _segment_cache_handles[rowset_id];
+ auto& segments = cache_handle.get_segments();
+
+ if (segments.empty()) {
+ continue;
+ }
+
+ if (rowset->is_segments_overlapping()) {
+ auto* largest_segment = segments[0].get();
+ for (size_t i = 1; i != segments.size(); ++i) {
+ if (segments[i]->num_rows() > largest_segment->num_rows()) {
+ largest_segment = segments[i].get();
+ }
+ }
+
+ if (largest_segment->num_rows() > max_rows) {
+ segment_group->rowset = rowset;
+ segment_group->num_rows = largest_segment->num_rows();
+ segment_group->segments.clear();
+ segment_group->segments.emplace_back(largest_segment);
+ max_rows = largest_segment->num_rows();
+ }
+ } else if (rowset->num_rows() > max_rows) {
+ max_rows = rowset->num_rows();
+ segment_group->rowset = rowset;
+ segment_group->segments.clear();
+ segment_group->segments.reserve(segments.size());
+ segment_group->num_rows = 0;
+ for (auto& segment : segments) {
+ segment_group->num_rows += segment->num_rows();
+ segment_group->segments.emplace_back(segment.get());
+ }
+ }
+ }
+
+ if (max_rows == 0) {
+ return {};
+ }
+
+ DCHECK(segment_group->rowset != nullptr);
+ return segment_group;
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_parse_segment_group(SegmentGroup& group) {
+ for (auto* segment : group.segments) {
+ RETURN_IF_ERROR(segment->load_index());
+ const ShortKeyIndexDecoder* index = segment->get_short_key_index();
+ group.num_blocks += index->num_items();
+ }
+ return Status::OK();
+}
+
+template <typename ParentType>
+std::shared_ptr<NewOlapScanner> ParallelScannerBuilder<ParentType>::_build_scanner(
+ BaseTabletSPtr tablet, int64_t version, const std::vector<OlapScanRange*>& key_ranges,
+ TabletReader::ReadSource&& read_source) {
+ NewOlapScanner::Params params {
+ _state, _scanner_profile.get(), key_ranges, std::move(tablet),
+ version, std::move(read_source), _limit_per_scanner, _is_preaggregation};
+ return NewOlapScanner::create_shared(_parent, std::move(params));
+}
+
+// Convert key ranges from `OlapScanRange` to `RowCursor` and then encode them into `std::string`.
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_convert_key_ranges(
+ const TabletSPtr& tablet, std::vector<std::string>& start_keys,
+ std::vector<std::string>& end_keys, std::vector<bool>& include_begin_keys,
+ std::vector<bool>& include_end_keys, std::shared_ptr<Schema>& schema) {
+ DCHECK(start_keys.empty());
+ DCHECK(end_keys.empty());
+
+ TabletSchemaSPtr tablet_schema = tablet->tablet_schema();
+
+ std::vector<uint32_t> columns;
+ if (_key_ranges.empty()) {
+ columns.resize(tablet->num_short_key_columns());
+ } else {
+ DCHECK_EQ(_key_ranges.front()->end_scan_range.size(),
+ _key_ranges.front()->begin_scan_range.size());
+ columns.resize(_key_ranges.front()->end_scan_range.size());
+ }
+
+ std::iota(columns.begin(), columns.end(), 0);
+ schema = std::make_shared<Schema>(tablet_schema->columns(), columns);
+
+ if (_key_ranges.empty()) {
+ /// Empty `std::string` means the min/max value of keys which will be handled in `SegmentIterator`.
+ start_keys.emplace_back();
+ end_keys.emplace_back();
+ include_begin_keys.emplace_back(true);
+ include_end_keys.emplace_back(true);
+ return Status::OK();
+ }
+
+ for (auto& key_range : _key_ranges) {
+ start_keys.emplace_back();
+ end_keys.emplace_back();
+
+ include_begin_keys.emplace_back(key_range->begin_include);
+ include_end_keys.emplace_back(key_range->end_include);
+
+ RowCursor start_key;
+ RowCursor end_key;
+ RETURN_IF_ERROR(start_key.init_scan_key(tablet->tablet_schema(),
+ key_range->begin_scan_range.values(), schema));
+ RETURN_IF_ERROR(start_key.from_tuple(key_range->begin_scan_range));
+
+ encode_key_with_padding(&start_keys.back(), start_key,
+ tablet_schema->num_short_key_columns(), key_range->begin_include);
+
+ RETURN_IF_ERROR(end_key.init_scan_key(tablet->tablet_schema(),
+ key_range->end_scan_range.values(), schema));
+ RETURN_IF_ERROR(end_key.from_tuple(key_range->end_scan_range));
+
+ encode_key_with_padding(&end_keys.back(), end_key, tablet_schema->num_short_key_columns(),
+ !key_range->end_include);
+ }
+
+ return Status::OK();
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
Review Comment:
warning: function '_build_scanners_by_key_range' exceeds recommended size/complexity thresholds [readability-function-size]
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
^
```
<details>
<summary>Additional context</summary>
**be/src/olap/parallel_scanner_builder.cpp:334:** 132 lines including whitespace and comments (threshold 80)
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
^
```
</details>
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "mrhhsg (via GitHub)" <gi...@apache.org>.
mrhhsg commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1844193804
run buildall
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1418266319
##########
be/src/olap/parallel_scanner_builder.cpp:
##########
@@ -0,0 +1,170 @@
+// 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 "parallel_scanner_builder.h"
+
+#include "olap/rowset/beta_rowset.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
+using namespace vectorized;
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::build_scanners(std::list<VScannerSPtr>& scanners) {
+ return _build_scanners_by_rowid(scanners);
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
Review Comment:
warning: function '_build_scanners_by_rowid' exceeds recommended size/complexity thresholds [readability-function-size]
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
^
```
<details>
<summary>Additional context</summary>
**be/src/olap/parallel_scanner_builder.cpp:32:** 116 lines including whitespace and comments (threshold 80)
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
^
```
</details>
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1435939520
##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -392,35 +396,57 @@ Status SegmentIterator::_get_row_ranges_by_keys() {
DorisMetrics::instance()->segment_row_total->increment(num_rows());
// fast path for empty segment or empty key ranges
- if (_row_bitmap.isEmpty() || _opts.key_ranges.empty()) {
- return Status::OK();
- }
-
- // Read & seek key columns is a waste of time when no key column in _schema
- if (std::none_of(_schema->columns().begin(), _schema->columns().end(), [&](const Field* col) {
- return col && _opts.tablet_schema->column_by_uid(col->unique_id()).is_key();
- })) {
+ if (_row_bitmap.isEmpty() || (!_opts.split_key_range.valid && _opts.key_ranges.empty())) {
return Status::OK();
}
RowRanges result_ranges;
- for (auto& key_range : _opts.key_ranges) {
+ if (_opts.split_key_range.valid) {
rowid_t lower_rowid = 0;
rowid_t upper_rowid = num_rows();
- RETURN_IF_ERROR(_prepare_seek(key_range));
- if (key_range.upper_key != nullptr) {
- // If client want to read upper_bound, the include_upper is true. So we
- // should get the first ordinal at which key is larger than upper_bound.
- // So we call _lookup_ordinal with include_upper's negate
- RETURN_IF_ERROR(_lookup_ordinal(*key_range.upper_key, !key_range.include_upper,
- num_rows(), &upper_rowid));
+
+ RETURN_IF_ERROR(_prepare_seek(_opts.split_key_range));
+
+ if (!_opts.split_key_range.upper_key.key.empty()) {
+ RETURN_IF_ERROR(_lookup_ordinal_from_sk_index<false>(
Review Comment:
split key range ,如果传递的是string,那么 200 就没了,消息就丧失了。 look up的时候就不能准确比较了。
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1427608602
##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -430,6 +455,53 @@ Status SegmentIterator::_get_row_ranges_by_keys() {
return Status::OK();
}
+Status SegmentIterator::_prepare_seek(const StorageReadOptions::SplitKeyRange& key_range) {
Review Comment:
warning: method '_prepare_seek' can be made static [readability-convert-member-functions-to-static]
be/src/olap/rowset/segment_v2/segment_iterator.h:165:
```diff
- [[nodiscard]] Status _prepare_seek(const StorageReadOptions::SplitKeyRange& key_range);
+ [[nodiscard]] static Status _prepare_seek(const StorageReadOptions::SplitKeyRange& key_range);
```
##########
be/src/olap/parallel_scanner_builder.cpp:
##########
@@ -0,0 +1,443 @@
+// 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 "parallel_scanner_builder.h"
+
+#include "exec/olap_utils.h"
+#include "olap/iterators.h"
+#include "olap/primary_key_index.h"
+#include "olap/row_cursor.h"
+#include "olap/rowset/beta_rowset.h"
+#include "olap/rowset/segment_v2/segment.h"
+#include "olap/short_key_index.h"
+#include "util/key_util.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
+using namespace vectorized;
+
+using SplitKey = StorageReadOptions::SplitKey;
+using SplitKeyRange = StorageReadOptions::SplitKeyRange;
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::build_scanners(std::list<VScannerSPtr>& scanners) {
+ RETURN_IF_ERROR(_load());
+ if (_is_dup_mow_key) {
+ return _build_scanners_by_rowid(scanners);
+ } else {
+ return _build_scanners_by_key_range(scanners);
+ }
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
Review Comment:
warning: function '_build_scanners_by_rowid' exceeds recommended size/complexity thresholds [readability-function-size]
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
^
```
<details>
<summary>Additional context</summary>
**be/src/olap/parallel_scanner_builder.cpp:47:** 107 lines including whitespace and comments (threshold 80)
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
^
```
</details>
##########
be/src/olap/iterators.h:
##########
@@ -69,10 +70,76 @@ class StorageReadOptions {
bool include_upper;
};
+ struct SplitKey {
+ std::string key;
+ std::shared_ptr<Schema> schema;
+ bool include;
+ };
+
+ struct SplitKeyRange {
+ SplitKeyRange() = default;
+
+ SplitKeyRange(SplitKey&& lower_key, SplitKey&& upper_key)
+ : lower_key(std::move(lower_key)), upper_key(std::move(upper_key)), valid(true) {}
+
+ SplitKeyRange(const SplitKeyRange&) = default;
+
+ SplitKeyRange(SplitKeyRange&& other) {
+ if (other.valid) {
+ lower_key = std::move(other.lower_key);
+ upper_key = std::move(other.upper_key);
+ }
+ valid = other.valid;
+ other.valid = false;
+ }
+
+ SplitKeyRange& operator=(const SplitKeyRange& other) = default;
+
+ SplitKeyRange& operator=(SplitKeyRange&& other) {
+ if (this != &other) {
+ lower_key = std::move(other.lower_key);
+ upper_key = std::move(other.upper_key);
+
+ valid = other.valid;
+ other.valid = false;
+ }
+ return *this;
+ }
+
+ [[nodiscard]] std::string to_string() const {
Review Comment:
warning: method 'to_string' can be made static [readability-convert-member-functions-to-static]
```suggestion
[[nodiscard]] static std::string to_string() {
```
##########
be/src/olap/parallel_scanner_builder.cpp:
##########
@@ -0,0 +1,443 @@
+// 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 "parallel_scanner_builder.h"
+
+#include "exec/olap_utils.h"
+#include "olap/iterators.h"
+#include "olap/primary_key_index.h"
+#include "olap/row_cursor.h"
+#include "olap/rowset/beta_rowset.h"
+#include "olap/rowset/segment_v2/segment.h"
+#include "olap/short_key_index.h"
+#include "util/key_util.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
+using namespace vectorized;
+
+using SplitKey = StorageReadOptions::SplitKey;
+using SplitKeyRange = StorageReadOptions::SplitKeyRange;
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::build_scanners(std::list<VScannerSPtr>& scanners) {
+ RETURN_IF_ERROR(_load());
+ if (_is_dup_mow_key) {
+ return _build_scanners_by_rowid(scanners);
+ } else {
+ return _build_scanners_by_key_range(scanners);
+ }
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
+ std::list<VScannerSPtr>& scanners) {
+ DCHECK_GE(_rows_per_scanners, _min_rows_per_scanner);
+ for (auto&& [tablet, version] : _tablets) {
+ DCHECK(_all_rowsets.contains(tablet->tablet_id()));
+ auto& rowsets = _all_rowsets[tablet->tablet_id()];
+
+ TabletReader::ReadSource read_source;
+
+ int64_t rows_collected = 0;
+ for (auto& rowset : rowsets) {
+ auto beta_rowset = std::dynamic_pointer_cast<BetaRowset>(rowset);
+ RowsetReaderSharedPtr reader;
+ RETURN_IF_ERROR(beta_rowset->create_reader(&reader));
+ const auto rowset_id = beta_rowset->rowset_id();
+
+ DCHECK(_segment_cache_handles.contains(rowset_id));
+ auto& segment_cache_handle = _segment_cache_handles[rowset_id];
+
+ if (beta_rowset->num_rows() == 0) {
+ continue;
+ }
+
+ const auto& segments = segment_cache_handle.get_segments();
+ int segment_start = 0;
+ auto split = RowSetSplits(reader->clone());
+ size_t total_collected = 0;
+
+ for (size_t i = 0; i != segments.size(); ++i) {
+ const auto& segment = segments[i];
+ RowRanges row_ranges;
+ const size_t rows_of_segment = segment->num_rows();
+ int64_t offset_in_segment = 0;
+
+ while (offset_in_segment < rows_of_segment) {
+ const int64_t remaining_rows = rows_of_segment - offset_in_segment;
+ auto rows_need = _rows_per_scanners - rows_collected;
+ if (rows_need >= remaining_rows * 0.9) {
+ rows_need = remaining_rows;
+ }
+ DCHECK_LE(rows_need, remaining_rows);
+
+ auto old_count = row_ranges.count();
+ row_ranges.add({offset_in_segment,
+ offset_in_segment + static_cast<int64_t>(rows_need)});
+ DCHECK_EQ(rows_need + old_count, row_ranges.count());
+ rows_collected += rows_need;
+ offset_in_segment += rows_need;
+ total_collected += rows_need;
+
+ if (rows_collected >= _rows_per_scanners) { // build a new scanner
+ split.segment_offsets.first = segment_start,
+ split.segment_offsets.second = i + 1;
+ split.segment_row_ranges.emplace_back(std::move(row_ranges));
+
+ DCHECK_EQ(split.segment_offsets.second - split.segment_offsets.first,
+ split.segment_row_ranges.size());
+
+ read_source.rs_splits.emplace_back(std::move(split));
+
+ scanners.emplace_back(_build_scanner(tablet, version, _key_ranges,
+ std::move(read_source)));
+
+ read_source = TabletReader::ReadSource();
+ split = RowSetSplits(reader->clone());
+ row_ranges = RowRanges();
+ DCHECK(row_ranges.is_empty());
+ DCHECK_EQ(row_ranges.range_size(), 0);
+
+ segment_start = offset_in_segment < rows_of_segment ? i : i + 1;
+ rows_collected = 0;
+ }
+ }
+
+ if (!row_ranges.is_empty()) {
+ DCHECK_GT(rows_collected, 0);
+ DCHECK_EQ(row_ranges.to(), segment->num_rows());
+ split.segment_row_ranges.emplace_back(std::move(row_ranges));
+ }
+ }
+ DCHECK_EQ(total_collected, beta_rowset->num_rows());
+
+ DCHECK_LE(rows_collected, _rows_per_scanners);
+ if (rows_collected > 0) {
+ split.segment_offsets.first = segment_start;
+ split.segment_offsets.second = segments.size();
+ DCHECK_GT(split.segment_offsets.second, split.segment_offsets.first);
+ DCHECK_EQ(split.segment_row_ranges.size(),
+ split.segment_offsets.second - split.segment_offsets.first);
+ read_source.rs_splits.emplace_back(std::move(split));
+ }
+ } // end `for (auto& rowset : rowsets)`
+
+ DCHECK_LE(rows_collected, _rows_per_scanners);
+ if (rows_collected > 0) {
+ DCHECK_GT(read_source.rs_splits.size(), 0);
+ for (auto& split : read_source.rs_splits) {
+ DCHECK(split.rs_reader != nullptr);
+ DCHECK_LT(split.segment_offsets.first, split.segment_offsets.second);
+ DCHECK_EQ(split.segment_row_ranges.size(),
+ split.segment_offsets.second - split.segment_offsets.first);
+ }
+ scanners.emplace_back(
+ _build_scanner(tablet, version, _key_ranges, std::move(read_source)));
+ }
+ }
+
+ return Status::OK();
+}
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_load() {
+ for (auto&& [tablet, version] : _tablets) {
+ const auto tablet_id = tablet->tablet_id();
+ auto& rows = _tablets_rows.emplace_back(0);
+ auto& rowsets = _all_rowsets[tablet_id];
+ RETURN_IF_ERROR(tablet->capture_consistent_rowsets({0, version}, &rowsets));
+
+ for (auto& rowset : rowsets) {
+ RETURN_IF_ERROR(rowset->load());
+ const auto rowset_id = rowset->rowset_id();
+ auto& segment_cache_handle = _segment_cache_handles[rowset_id];
+
+ RETURN_IF_ERROR(SegmentLoader::instance()->load_segments(
+ std::dynamic_pointer_cast<BetaRowset>(rowset), &segment_cache_handle, true));
+ _total_rows += rowset->num_rows();
+ rows += _total_rows;
+ }
+ }
+
+ _rows_per_scanners = _total_rows / _max_scanners_count;
+ _rows_per_scanners = std::max<size_t>(_rows_per_scanners, _min_rows_per_scanner);
+
+ return Status::OK();
+}
+
+template <typename ParentType>
+std::unique_ptr<SegmentGroup>
+ParallelScannerBuilder<ParentType>::_create_segment_group_from_rowsets(
+ const std::vector<RowsetSharedPtr>& rowsets) {
+ if (rowsets.empty()) {
+ return {};
+ }
+
+ size_t max_rows = 0;
+ auto segment_group = std::make_unique<SegmentGroup>();
+ for (const auto& rowset : rowsets) {
+ const auto rowset_id = rowset->rowset_id();
+ DCHECK(_segment_cache_handles.contains(rowset_id));
+ auto& cache_handle = _segment_cache_handles[rowset_id];
+ auto& segments = cache_handle.get_segments();
+
+ if (segments.empty()) {
+ continue;
+ }
+
+ if (rowset->is_segments_overlapping()) {
+ auto* largest_segment = segments[0].get();
+ for (size_t i = 1; i != segments.size(); ++i) {
+ if (segments[i]->num_rows() > largest_segment->num_rows()) {
+ largest_segment = segments[i].get();
+ }
+ }
+
+ if (largest_segment->num_rows() > max_rows) {
+ segment_group->rowset = rowset;
+ segment_group->num_rows = largest_segment->num_rows();
+ segment_group->segments.clear();
+ segment_group->segments.emplace_back(largest_segment);
+ max_rows = largest_segment->num_rows();
+ }
+ } else if (rowset->num_rows() > max_rows) {
+ max_rows = rowset->num_rows();
+ segment_group->rowset = rowset;
+ segment_group->segments.clear();
+ segment_group->segments.reserve(segments.size());
+ segment_group->num_rows = 0;
+ for (auto& segment : segments) {
+ segment_group->num_rows += segment->num_rows();
+ segment_group->segments.emplace_back(segment.get());
+ }
+ }
+ }
+
+ if (max_rows == 0) {
+ return {};
+ }
+
+ DCHECK(segment_group->rowset != nullptr);
+ return segment_group;
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_parse_segment_group(SegmentGroup& group) {
+ for (auto* segment : group.segments) {
+ RETURN_IF_ERROR(segment->load_index());
+ const ShortKeyIndexDecoder* index = segment->get_short_key_index();
+ group.num_blocks += index->num_items();
+ }
+ return Status::OK();
+}
+
+template <typename ParentType>
+std::shared_ptr<NewOlapScanner> ParallelScannerBuilder<ParentType>::_build_scanner(
+ BaseTabletSPtr tablet, int64_t version, const std::vector<OlapScanRange*>& key_ranges,
+ TabletReader::ReadSource&& read_source) {
+ NewOlapScanner::Params params {
+ _state, _scanner_profile.get(), key_ranges, std::move(tablet),
+ version, std::move(read_source), _limit_per_scanner, _is_preaggregation};
+ return NewOlapScanner::create_shared(_parent, std::move(params));
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_convert_key_ranges(
+ const TabletSPtr& tablet, std::vector<std::string>& start_keys,
+ std::vector<std::string>& end_keys, std::vector<bool>& include_begin_keys,
+ std::vector<bool>& include_end_keys, std::shared_ptr<Schema>& schema) {
+ DCHECK(start_keys.empty());
+ DCHECK(end_keys.empty());
+
+ TabletSchemaSPtr tablet_schema = tablet->tablet_schema();
+
+ std::vector<uint32_t> columns;
+ if (_key_ranges.empty()) {
+ columns.resize(tablet->num_short_key_columns());
+ } else {
+ DCHECK_EQ(_key_ranges.front()->end_scan_range.size(),
+ _key_ranges.front()->begin_scan_range.size());
+ columns.resize(_key_ranges.front()->end_scan_range.size());
+ }
+
+ std::iota(columns.begin(), columns.end(), 0);
+ schema = std::make_shared<Schema>(tablet_schema->columns(), columns);
+
+ if (_key_ranges.empty()) {
+ start_keys.emplace_back();
+ end_keys.emplace_back();
+ include_begin_keys.emplace_back(true);
+ include_end_keys.emplace_back(true);
+ return Status::OK();
+ }
+
+ for (auto& key_range : _key_ranges) {
+ start_keys.emplace_back();
+ end_keys.emplace_back();
+
+ include_begin_keys.emplace_back(key_range->begin_include);
+ include_end_keys.emplace_back(key_range->end_include);
+
+ RowCursor start_key;
+ RowCursor end_key;
+ RETURN_IF_ERROR(start_key.init_scan_key(tablet->tablet_schema(),
+ key_range->begin_scan_range.values(), schema));
+ RETURN_IF_ERROR(start_key.from_tuple(key_range->begin_scan_range));
+
+ encode_key_with_padding(&start_keys.back(), start_key,
+ tablet_schema->num_short_key_columns(), key_range->begin_include);
+
+ RETURN_IF_ERROR(end_key.init_scan_key(tablet->tablet_schema(),
+ key_range->end_scan_range.values(), schema));
+ RETURN_IF_ERROR(end_key.from_tuple(key_range->end_scan_range));
+
+ encode_key_with_padding(&end_keys.back(), end_key, tablet_schema->num_short_key_columns(),
+ !key_range->end_include);
+ }
+
+ return Status::OK();
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
Review Comment:
warning: function '_build_scanners_by_key_range' exceeds recommended size/complexity thresholds [readability-function-size]
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
^
```
<details>
<summary>Additional context</summary>
**be/src/olap/parallel_scanner_builder.cpp:316:** 121 lines including whitespace and comments (threshold 80)
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
^
```
</details>
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "mrhhsg (via GitHub)" <gi...@apache.org>.
mrhhsg commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1857688309
run buildall
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1428009021
##########
be/src/olap/parallel_scanner_builder.cpp:
##########
@@ -0,0 +1,444 @@
+// 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 "parallel_scanner_builder.h"
+
+#include "exec/olap_utils.h"
+#include "olap/iterators.h"
+#include "olap/primary_key_index.h"
+#include "olap/row_cursor.h"
+#include "olap/rowset/beta_rowset.h"
+#include "olap/rowset/segment_v2/segment.h"
+#include "olap/short_key_index.h"
+#include "util/key_util.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
+using namespace vectorized;
+
+using SplitKey = StorageReadOptions::SplitKey;
+using SplitKeyRange = StorageReadOptions::SplitKeyRange;
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::build_scanners(std::list<VScannerSPtr>& scanners) {
+ RETURN_IF_ERROR(_load());
+ if (_is_dup_mow_key) {
+ return _build_scanners_by_rowid(scanners);
+ } else {
+ return _build_scanners_by_key_range(scanners);
+ }
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
Review Comment:
warning: function '_build_scanners_by_rowid' exceeds recommended size/complexity thresholds [readability-function-size]
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
^
```
<details>
<summary>Additional context</summary>
**be/src/olap/parallel_scanner_builder.cpp:47:** 108 lines including whitespace and comments (threshold 80)
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
^
```
</details>
##########
be/src/olap/parallel_scanner_builder.cpp:
##########
@@ -0,0 +1,444 @@
+// 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 "parallel_scanner_builder.h"
+
+#include "exec/olap_utils.h"
+#include "olap/iterators.h"
+#include "olap/primary_key_index.h"
+#include "olap/row_cursor.h"
+#include "olap/rowset/beta_rowset.h"
+#include "olap/rowset/segment_v2/segment.h"
+#include "olap/short_key_index.h"
+#include "util/key_util.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
+using namespace vectorized;
+
+using SplitKey = StorageReadOptions::SplitKey;
+using SplitKeyRange = StorageReadOptions::SplitKeyRange;
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::build_scanners(std::list<VScannerSPtr>& scanners) {
+ RETURN_IF_ERROR(_load());
+ if (_is_dup_mow_key) {
+ return _build_scanners_by_rowid(scanners);
+ } else {
+ return _build_scanners_by_key_range(scanners);
+ }
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
+ std::list<VScannerSPtr>& scanners) {
+ DCHECK_GE(_rows_per_scanners, _min_rows_per_scanner);
+ for (auto&& [tablet, version] : _tablets) {
+ DCHECK(_all_rowsets.contains(tablet->tablet_id()));
+ auto& rowsets = _all_rowsets[tablet->tablet_id()];
+
+ TabletReader::ReadSource read_source;
+
+ int64_t rows_collected = 0;
+ for (auto& rowset : rowsets) {
+ auto beta_rowset = std::dynamic_pointer_cast<BetaRowset>(rowset);
+ RowsetReaderSharedPtr reader;
+ RETURN_IF_ERROR(beta_rowset->create_reader(&reader));
+ const auto rowset_id = beta_rowset->rowset_id();
+
+ DCHECK(_segment_cache_handles.contains(rowset_id));
+ auto& segment_cache_handle = _segment_cache_handles[rowset_id];
+
+ if (beta_rowset->num_rows() == 0) {
+ continue;
+ }
+
+ const auto& segments = segment_cache_handle.get_segments();
+ int segment_start = 0;
+ auto split = RowSetSplits(reader->clone());
+
+ for (size_t i = 0; i != segments.size(); ++i) {
+ const auto& segment = segments[i];
+ RowRanges row_ranges;
+ const size_t rows_of_segment = segment->num_rows();
+ int64_t offset_in_segment = 0;
+
+ while (offset_in_segment < rows_of_segment) {
+ const int64_t remaining_rows = rows_of_segment - offset_in_segment;
+ auto rows_need = _rows_per_scanners - rows_collected;
+ if (rows_need >= remaining_rows * 0.9) {
+ rows_need = remaining_rows;
+ }
+ DCHECK_LE(rows_need, remaining_rows);
+
+ auto old_count = row_ranges.count();
+ row_ranges.add({offset_in_segment,
+ offset_in_segment + static_cast<int64_t>(rows_need)});
+ DCHECK_EQ(rows_need + old_count, row_ranges.count());
+ rows_collected += rows_need;
+ offset_in_segment += rows_need;
+
+ if (rows_collected >= _rows_per_scanners) { // build a new scanner
+ split.segment_offsets.first = segment_start,
+ split.segment_offsets.second = i + 1;
+ split.segment_row_ranges.emplace_back(std::move(row_ranges));
+
+ DCHECK_EQ(split.segment_offsets.second - split.segment_offsets.first,
+ split.segment_row_ranges.size());
+
+ read_source.rs_splits.emplace_back(std::move(split));
+
+ if (!_state->skip_delete_predicate()) {
+ read_source.fill_delete_predicates();
+ }
+
+ scanners.emplace_back(_build_scanner(tablet, version, _key_ranges,
+ std::move(read_source)));
+
+ read_source = TabletReader::ReadSource();
+ split = RowSetSplits(reader->clone());
+ row_ranges = RowRanges();
+
+ segment_start = offset_in_segment < rows_of_segment ? i : i + 1;
+ rows_collected = 0;
+ }
+ }
+
+ if (!row_ranges.is_empty()) {
+ DCHECK_GT(rows_collected, 0);
+ DCHECK_EQ(row_ranges.to(), segment->num_rows());
+ split.segment_row_ranges.emplace_back(std::move(row_ranges));
+ }
+ }
+
+ DCHECK_LE(rows_collected, _rows_per_scanners);
+ if (rows_collected > 0) {
+ split.segment_offsets.first = segment_start;
+ split.segment_offsets.second = segments.size();
+ DCHECK_GT(split.segment_offsets.second, split.segment_offsets.first);
+ DCHECK_EQ(split.segment_row_ranges.size(),
+ split.segment_offsets.second - split.segment_offsets.first);
+ read_source.rs_splits.emplace_back(std::move(split));
+ }
+ } // end `for (auto& rowset : rowsets)`
+
+ DCHECK_LE(rows_collected, _rows_per_scanners);
+ if (rows_collected > 0) {
+ DCHECK_GT(read_source.rs_splits.size(), 0);
+#ifndef NDEBUG
+ for (auto& split : read_source.rs_splits) {
+ DCHECK(split.rs_reader != nullptr);
+ DCHECK_LT(split.segment_offsets.first, split.segment_offsets.second);
+ DCHECK_EQ(split.segment_row_ranges.size(),
+ split.segment_offsets.second - split.segment_offsets.first);
+ }
+#endif
+ scanners.emplace_back(
+ _build_scanner(tablet, version, _key_ranges, std::move(read_source)));
+ }
+ }
+
+ return Status::OK();
+}
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_load() {
+ for (auto&& [tablet, version] : _tablets) {
+ const auto tablet_id = tablet->tablet_id();
+ auto& rows = _tablets_rows.emplace_back(0);
+ auto& rowsets = _all_rowsets[tablet_id];
+ RETURN_IF_ERROR(tablet->capture_consistent_rowsets({0, version}, &rowsets));
+
+ for (auto& rowset : rowsets) {
+ RETURN_IF_ERROR(rowset->load());
+ const auto rowset_id = rowset->rowset_id();
+ auto& segment_cache_handle = _segment_cache_handles[rowset_id];
+
+ RETURN_IF_ERROR(SegmentLoader::instance()->load_segments(
+ std::dynamic_pointer_cast<BetaRowset>(rowset), &segment_cache_handle, true));
+ _total_rows += rowset->num_rows();
+ rows += _total_rows;
+ }
+ }
+
+ _rows_per_scanners = _total_rows / _max_scanners_count;
+ _rows_per_scanners = std::max<size_t>(_rows_per_scanners, _min_rows_per_scanner);
+
+ return Status::OK();
+}
+
+template <typename ParentType>
+std::unique_ptr<SegmentGroup>
+ParallelScannerBuilder<ParentType>::_create_segment_group_from_rowsets(
+ const std::vector<RowsetSharedPtr>& rowsets) {
+ if (rowsets.empty()) {
+ return {};
+ }
+
+ size_t max_rows = 0;
+ auto segment_group = std::make_unique<SegmentGroup>();
+ for (const auto& rowset : rowsets) {
+ const auto rowset_id = rowset->rowset_id();
+ DCHECK(_segment_cache_handles.contains(rowset_id));
+ auto& cache_handle = _segment_cache_handles[rowset_id];
+ auto& segments = cache_handle.get_segments();
+
+ if (segments.empty()) {
+ continue;
+ }
+
+ if (rowset->is_segments_overlapping()) {
+ auto* largest_segment = segments[0].get();
+ for (size_t i = 1; i != segments.size(); ++i) {
+ if (segments[i]->num_rows() > largest_segment->num_rows()) {
+ largest_segment = segments[i].get();
+ }
+ }
+
+ if (largest_segment->num_rows() > max_rows) {
+ segment_group->rowset = rowset;
+ segment_group->num_rows = largest_segment->num_rows();
+ segment_group->segments.clear();
+ segment_group->segments.emplace_back(largest_segment);
+ max_rows = largest_segment->num_rows();
+ }
+ } else if (rowset->num_rows() > max_rows) {
+ max_rows = rowset->num_rows();
+ segment_group->rowset = rowset;
+ segment_group->segments.clear();
+ segment_group->segments.reserve(segments.size());
+ segment_group->num_rows = 0;
+ for (auto& segment : segments) {
+ segment_group->num_rows += segment->num_rows();
+ segment_group->segments.emplace_back(segment.get());
+ }
+ }
+ }
+
+ if (max_rows == 0) {
+ return {};
+ }
+
+ DCHECK(segment_group->rowset != nullptr);
+ return segment_group;
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_parse_segment_group(SegmentGroup& group) {
+ for (auto* segment : group.segments) {
+ RETURN_IF_ERROR(segment->load_index());
+ const ShortKeyIndexDecoder* index = segment->get_short_key_index();
+ group.num_blocks += index->num_items();
+ }
+ return Status::OK();
+}
+
+template <typename ParentType>
+std::shared_ptr<NewOlapScanner> ParallelScannerBuilder<ParentType>::_build_scanner(
+ BaseTabletSPtr tablet, int64_t version, const std::vector<OlapScanRange*>& key_ranges,
+ TabletReader::ReadSource&& read_source) {
+ NewOlapScanner::Params params {
+ _state, _scanner_profile.get(), key_ranges, std::move(tablet),
+ version, std::move(read_source), _limit_per_scanner, _is_preaggregation};
+ return NewOlapScanner::create_shared(_parent, std::move(params));
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_convert_key_ranges(
+ const TabletSPtr& tablet, std::vector<std::string>& start_keys,
+ std::vector<std::string>& end_keys, std::vector<bool>& include_begin_keys,
+ std::vector<bool>& include_end_keys, std::shared_ptr<Schema>& schema) {
+ DCHECK(start_keys.empty());
+ DCHECK(end_keys.empty());
+
+ TabletSchemaSPtr tablet_schema = tablet->tablet_schema();
+
+ std::vector<uint32_t> columns;
+ if (_key_ranges.empty()) {
+ columns.resize(tablet->num_short_key_columns());
+ } else {
+ DCHECK_EQ(_key_ranges.front()->end_scan_range.size(),
+ _key_ranges.front()->begin_scan_range.size());
+ columns.resize(_key_ranges.front()->end_scan_range.size());
+ }
+
+ std::iota(columns.begin(), columns.end(), 0);
+ schema = std::make_shared<Schema>(tablet_schema->columns(), columns);
+
+ if (_key_ranges.empty()) {
+ start_keys.emplace_back();
+ end_keys.emplace_back();
+ include_begin_keys.emplace_back(true);
+ include_end_keys.emplace_back(true);
+ return Status::OK();
+ }
+
+ for (auto& key_range : _key_ranges) {
+ start_keys.emplace_back();
+ end_keys.emplace_back();
+
+ include_begin_keys.emplace_back(key_range->begin_include);
+ include_end_keys.emplace_back(key_range->end_include);
+
+ RowCursor start_key;
+ RowCursor end_key;
+ RETURN_IF_ERROR(start_key.init_scan_key(tablet->tablet_schema(),
+ key_range->begin_scan_range.values(), schema));
+ RETURN_IF_ERROR(start_key.from_tuple(key_range->begin_scan_range));
+
+ encode_key_with_padding(&start_keys.back(), start_key,
+ tablet_schema->num_short_key_columns(), key_range->begin_include);
+
+ RETURN_IF_ERROR(end_key.init_scan_key(tablet->tablet_schema(),
+ key_range->end_scan_range.values(), schema));
+ RETURN_IF_ERROR(end_key.from_tuple(key_range->end_scan_range));
+
+ encode_key_with_padding(&end_keys.back(), end_key, tablet_schema->num_short_key_columns(),
+ !key_range->end_include);
+ }
+
+ return Status::OK();
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
Review Comment:
warning: function '_build_scanners_by_key_range' exceeds recommended size/complexity thresholds [readability-function-size]
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
^
```
<details>
<summary>Additional context</summary>
**be/src/olap/parallel_scanner_builder.cpp:317:** 121 lines including whitespace and comments (threshold 80)
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
^
```
</details>
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "mrhhsg (via GitHub)" <gi...@apache.org>.
mrhhsg commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1858139366
run buildall
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "mrhhsg (via GitHub)" <gi...@apache.org>.
mrhhsg commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1858849348
run buildall
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1858857995
TPC-H test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
```
Tpch sf100 test result on commit c539c9ccbd945621fac57f8a72d9ee1a37c3f4ee, data reload: false
run tpch-sf100 query with default conf and session variables
q1 4751 4487 4472 4472
q2 371 144 167 144
q3 1459 1247 1207 1207
q4 1118 939 919 919
q5 3111 3125 3160 3125
q6 244 128 127 127
q7 1000 481 476 476
q8 2218 2210 2157 2157
q9 6662 6674 6622 6622
q10 3210 3292 3272 3272
q11 324 211 202 202
q12 354 203 214 203
q13 4557 3831 3817 3817
q14 240 213 220 213
q15 567 521 512 512
q16 435 401 385 385
q17 1011 679 591 591
q18 7279 6896 6911 6896
q19 1533 1417 1394 1394
q20 513 322 300 300
q21 3036 2690 2645 2645
q22 350 279 294 279
Total cold run time: 44343 ms
Total hot run time: 39958 ms
run tpch-sf100 query with default conf and set session variable runtime_filter_mode=off
q1 4404 4446 4415 4415
q2 270 161 168 161
q3 3533 3529 3531 3529
q4 2374 2372 2361 2361
q5 5735 5727 5736 5727
q6 241 122 120 120
q7 2425 1906 1893 1893
q8 3512 3510 3526 3510
q9 9003 8987 8957 8957
q10 3878 3963 4024 3963
q11 501 400 390 390
q12 768 577 598 577
q13 4294 3572 3596 3572
q14 287 249 258 249
q15 570 524 519 519
q16 506 459 467 459
q17 1884 1859 1842 1842
q18 8711 8231 8754 8231
q19 1731 1745 1748 1745
q20 2236 1934 1924 1924
q21 6517 6142 6116 6116
q22 521 434 434 434
Total cold run time: 63901 ms
Total hot run time: 60694 ms
```
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1432482896
##########
be/src/olap/parallel_scanner_builder.cpp:
##########
@@ -0,0 +1,474 @@
+// 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 "parallel_scanner_builder.h"
+
+#include "exec/olap_utils.h"
+#include "olap/iterators.h"
+#include "olap/primary_key_index.h"
+#include "olap/row_cursor.h"
+#include "olap/rowset/beta_rowset.h"
+#include "olap/rowset/segment_v2/segment.h"
+#include "olap/short_key_index.h"
+#include "util/key_util.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
+using namespace vectorized;
+
+using SplitKey = StorageReadOptions::SplitKey;
+using SplitKeyRange = StorageReadOptions::SplitKeyRange;
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::build_scanners(std::list<VScannerSPtr>& scanners) {
+ RETURN_IF_ERROR(_load());
+ if (_is_dup_mow_key) {
+ return _build_scanners_by_rowid(scanners);
+ } else {
+ return _build_scanners_by_key_range(scanners);
+ }
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
+ std::list<VScannerSPtr>& scanners) {
+ DCHECK_GE(_rows_per_scanner, _min_rows_per_scanner);
+ for (auto&& [tablet, version] : _tablets) {
+ DCHECK(_all_rowsets.contains(tablet->tablet_id()));
+ auto& rowsets = _all_rowsets[tablet->tablet_id()];
+
+ TabletReader::ReadSource reade_source_with_delete_info;
+ if (!_state->skip_delete_predicate()) {
+ RETURN_IF_ERROR(tablet->capture_rs_readers(
+ {0, version}, &reade_source_with_delete_info.rs_splits, false));
+ reade_source_with_delete_info.fill_delete_predicates();
+ }
+
+ TabletReader::ReadSource read_source;
+
+ int64_t rows_collected = 0;
+ for (auto& rowset : rowsets) {
+ auto beta_rowset = std::dynamic_pointer_cast<BetaRowset>(rowset);
+ RowsetReaderSharedPtr reader;
+ RETURN_IF_ERROR(beta_rowset->create_reader(&reader));
+ const auto rowset_id = beta_rowset->rowset_id();
+
+ DCHECK(_segment_cache_handles.contains(rowset_id));
+ auto& segment_cache_handle = _segment_cache_handles[rowset_id];
+
+ if (beta_rowset->num_rows() == 0) {
+ continue;
+ }
+
+ const auto& segments = segment_cache_handle.get_segments();
+ int segment_start = 0;
+ auto split = RowSetSplits(reader->clone());
+
+ for (size_t i = 0; i != segments.size(); ++i) {
+ const auto& segment = segments[i];
+ RowRanges row_ranges;
+ const size_t rows_of_segment = segment->num_rows();
+ int64_t offset_in_segment = 0;
+
+ // try to split large segments into RowRanges
+ while (offset_in_segment < rows_of_segment) {
+ const int64_t remaining_rows = rows_of_segment - offset_in_segment;
+ auto rows_need = _rows_per_scanner - rows_collected;
+
+ // 0.9: try to avoid splitting the segments into excessively small parts.
+ if (rows_need >= remaining_rows * 0.9) {
+ rows_need = remaining_rows;
+ }
+ DCHECK_LE(rows_need, remaining_rows);
+
+ // RowRange stands for range: [From, To), From is inclusive, To is exclusive.
+ row_ranges.add({offset_in_segment,
+ offset_in_segment + static_cast<int64_t>(rows_need)});
+ rows_collected += rows_need;
+ offset_in_segment += rows_need;
+
+ // If collected enough rows, build a new scanner
+ if (rows_collected >= _rows_per_scanner) {
+ split.segment_offsets.first = segment_start,
+ split.segment_offsets.second = i + 1;
+ split.segment_row_ranges.emplace_back(std::move(row_ranges));
+
+ DCHECK_EQ(split.segment_offsets.second - split.segment_offsets.first,
+ split.segment_row_ranges.size());
+
+ read_source.rs_splits.emplace_back(std::move(split));
+
+ scanners.emplace_back(
+ _build_scanner(tablet, version, _key_ranges,
+ {std::move(read_source.rs_splits),
+ reade_source_with_delete_info.delete_predicates}));
+
+ read_source = TabletReader::ReadSource();
+ split = RowSetSplits(reader->clone());
+ row_ranges = RowRanges();
+
+ segment_start = offset_in_segment < rows_of_segment ? i : i + 1;
+ rows_collected = 0;
+ }
+ }
+
+ // The non-empty `row_ranges` means there are some rows left in this segment not added into `split`.
+ if (!row_ranges.is_empty()) {
+ DCHECK_GT(rows_collected, 0);
+ DCHECK_EQ(row_ranges.to(), segment->num_rows());
+ split.segment_row_ranges.emplace_back(std::move(row_ranges));
+ }
+ }
+
+ DCHECK_LE(rows_collected, _rows_per_scanner);
+ if (rows_collected > 0) {
+ split.segment_offsets.first = segment_start;
+ split.segment_offsets.second = segments.size();
+ DCHECK_GT(split.segment_offsets.second, split.segment_offsets.first);
+ DCHECK_EQ(split.segment_row_ranges.size(),
+ split.segment_offsets.second - split.segment_offsets.first);
+ read_source.rs_splits.emplace_back(std::move(split));
+ }
+ } // end `for (auto& rowset : rowsets)`
+
+ DCHECK_LE(rows_collected, _rows_per_scanner);
+ if (rows_collected > 0) {
+ DCHECK_GT(read_source.rs_splits.size(), 0);
+#ifndef NDEBUG
+ for (auto& split : read_source.rs_splits) {
+ DCHECK(split.rs_reader != nullptr);
+ DCHECK_LT(split.segment_offsets.first, split.segment_offsets.second);
+ DCHECK_EQ(split.segment_row_ranges.size(),
+ split.segment_offsets.second - split.segment_offsets.first);
+ }
+#endif
+ scanners.emplace_back(
+ _build_scanner(tablet, version, _key_ranges,
+ {std::move(read_source.rs_splits),
+ reade_source_with_delete_info.delete_predicates}));
+ }
+ }
+
+ return Status::OK();
+}
+
+/**
+ * Load rowsets of each tablet with specified version, segments of each rowset.
+ */
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_load() {
+ for (auto&& [tablet, version] : _tablets) {
+ const auto tablet_id = tablet->tablet_id();
+ _tablets_rows.emplace_back(0);
+ auto& rows = _tablets_rows.back();
+ auto& rowsets = _all_rowsets[tablet_id];
+ RETURN_IF_ERROR(tablet->capture_consistent_rowsets({0, version}, &rowsets));
+
+ for (auto& rowset : rowsets) {
+ RETURN_IF_ERROR(rowset->load());
+ const auto rowset_id = rowset->rowset_id();
+ auto& segment_cache_handle = _segment_cache_handles[rowset_id];
+
+ /// All loaded segments will be cached into segment_cache_handle.
+ RETURN_IF_ERROR(SegmentLoader::instance()->load_segments(
+ std::dynamic_pointer_cast<BetaRowset>(rowset), &segment_cache_handle, true));
+ _total_rows += rowset->num_rows();
+ rows += _total_rows;
+ }
+ }
+
+ _rows_per_scanner = _total_rows / _max_scanners_count;
+ _rows_per_scanner = std::max<size_t>(_rows_per_scanner, _min_rows_per_scanner);
+
+ return Status::OK();
+}
+
+template <typename ParentType>
+std::unique_ptr<SegmentGroup>
+ParallelScannerBuilder<ParentType>::_create_segment_group_from_rowsets(
+ const std::vector<RowsetSharedPtr>& rowsets) {
+ if (rowsets.empty()) {
+ return {};
+ }
+
+ size_t max_rows = 0;
+ auto segment_group = std::make_unique<SegmentGroup>();
+ for (const auto& rowset : rowsets) {
+ const auto rowset_id = rowset->rowset_id();
+ DCHECK(_segment_cache_handles.contains(rowset_id));
+ auto& cache_handle = _segment_cache_handles[rowset_id];
+ auto& segments = cache_handle.get_segments();
+
+ if (segments.empty()) {
+ continue;
+ }
+
+ if (rowset->is_segments_overlapping()) {
+ auto* largest_segment = segments[0].get();
+ for (size_t i = 1; i != segments.size(); ++i) {
+ if (segments[i]->num_rows() > largest_segment->num_rows()) {
+ largest_segment = segments[i].get();
+ }
+ }
+
+ if (largest_segment->num_rows() > max_rows) {
+ segment_group->rowset = rowset;
+ segment_group->num_rows = largest_segment->num_rows();
+ segment_group->segments.clear();
+ segment_group->segments.emplace_back(largest_segment);
+ max_rows = largest_segment->num_rows();
+ }
+ } else if (rowset->num_rows() > max_rows) {
+ max_rows = rowset->num_rows();
+ segment_group->rowset = rowset;
+ segment_group->segments.clear();
+ segment_group->segments.reserve(segments.size());
+ segment_group->num_rows = 0;
+ for (auto& segment : segments) {
+ segment_group->num_rows += segment->num_rows();
+ segment_group->segments.emplace_back(segment.get());
+ }
+ }
+ }
+
+ if (max_rows == 0) {
+ return {};
+ }
+
+ DCHECK(segment_group->rowset != nullptr);
+ return segment_group;
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_parse_segment_group(SegmentGroup& group) {
+ for (auto* segment : group.segments) {
+ RETURN_IF_ERROR(segment->load_index());
+ const ShortKeyIndexDecoder* index = segment->get_short_key_index();
+ group.num_blocks += index->num_items();
+ }
+ return Status::OK();
+}
+
+template <typename ParentType>
+std::shared_ptr<NewOlapScanner> ParallelScannerBuilder<ParentType>::_build_scanner(
+ BaseTabletSPtr tablet, int64_t version, const std::vector<OlapScanRange*>& key_ranges,
+ TabletReader::ReadSource&& read_source) {
+ NewOlapScanner::Params params {
+ _state, _scanner_profile.get(), key_ranges, std::move(tablet),
+ version, std::move(read_source), _limit_per_scanner, _is_preaggregation};
+ return NewOlapScanner::create_shared(_parent, std::move(params));
+}
+
+// Convert key ranges from `OlapScanRange` to `RowCursor` and then encode them into `std::string`.
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_convert_key_ranges(
+ const TabletSPtr& tablet, std::vector<std::string>& start_keys,
+ std::vector<std::string>& end_keys, std::vector<bool>& include_begin_keys,
+ std::vector<bool>& include_end_keys, std::shared_ptr<Schema>& schema) {
+ DCHECK(start_keys.empty());
+ DCHECK(end_keys.empty());
+
+ TabletSchemaSPtr tablet_schema = tablet->tablet_schema();
+
+ std::vector<uint32_t> columns;
+ if (_key_ranges.empty()) {
+ columns.resize(tablet->num_short_key_columns());
+ } else {
+ DCHECK_EQ(_key_ranges.front()->end_scan_range.size(),
+ _key_ranges.front()->begin_scan_range.size());
+ columns.resize(_key_ranges.front()->end_scan_range.size());
+ }
+
+ std::iota(columns.begin(), columns.end(), 0);
+ schema = std::make_shared<Schema>(tablet_schema->columns(), columns);
+
+ if (_key_ranges.empty()) {
+ /// Empty `std::string` means the min/max value of keys which will be handled in `SegmentIterator`.
+ start_keys.emplace_back();
+ end_keys.emplace_back();
+ include_begin_keys.emplace_back(true);
+ include_end_keys.emplace_back(true);
+ return Status::OK();
+ }
+
+ for (auto& key_range : _key_ranges) {
+ start_keys.emplace_back();
+ end_keys.emplace_back();
+
+ include_begin_keys.emplace_back(key_range->begin_include);
+ include_end_keys.emplace_back(key_range->end_include);
+
+ RowCursor start_key;
+ RowCursor end_key;
+ RETURN_IF_ERROR(start_key.init_scan_key(tablet->tablet_schema(),
+ key_range->begin_scan_range.values(), schema));
+ RETURN_IF_ERROR(start_key.from_tuple(key_range->begin_scan_range));
+
+ encode_key_with_padding(&start_keys.back(), start_key,
+ tablet_schema->num_short_key_columns(), key_range->begin_include);
+
+ RETURN_IF_ERROR(end_key.init_scan_key(tablet->tablet_schema(),
+ key_range->end_scan_range.values(), schema));
+ RETURN_IF_ERROR(end_key.from_tuple(key_range->end_scan_range));
+
+ encode_key_with_padding(&end_keys.back(), end_key, tablet_schema->num_short_key_columns(),
+ !key_range->end_include);
+ }
+
+ return Status::OK();
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
Review Comment:
warning: function '_build_scanners_by_key_range' exceeds recommended size/complexity thresholds [readability-function-size]
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
^
```
<details>
<summary>Additional context</summary>
**be/src/olap/parallel_scanner_builder.cpp:336:** 132 lines including whitespace and comments (threshold 80)
```cpp
Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
^
```
</details>
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1865315419
TPC-H test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
```
Tpch sf100 test result on commit e9a020cbd6ccaf66073dc4f03d8e7516085669c8, data reload: false
run tpch-sf100 query with default conf and session variables
q1 4700 4427 4446 4427
q2 366 149 157 149
q3 1450 1190 1228 1190
q4 1110 911 902 902
q5 3183 3155 3152 3152
q6 246 129 127 127
q7 987 485 486 485
q8 2184 2210 2159 2159
q9 6742 6618 6673 6618
q10 3207 3291 3276 3276
q11 316 187 191 187
q12 352 221 207 207
q13 4557 3812 3796 3796
q14 240 220 216 216
q15 567 521 524 521
q16 449 401 394 394
q17 994 552 528 528
q18 7232 6898 6845 6845
q19 1505 1257 1435 1257
q20 531 319 327 319
q21 3082 2602 2666 2602
q22 359 288 293 288
Total cold run time: 44359 ms
Total hot run time: 39645 ms
run tpch-sf100 query with default conf and set session variable runtime_filter_mode=off
q1 4365 4351 4384 4351
q2 274 169 182 169
q3 3534 3526 3523 3523
q4 2382 2367 2368 2367
q5 5740 5756 5738 5738
q6 239 119 120 119
q7 2382 1876 1872 1872
q8 3507 3536 3505 3505
q9 9034 9018 8952 8952
q10 3903 4027 4025 4025
q11 490 373 379 373
q12 765 612 593 593
q13 4320 3565 3598 3565
q14 290 253 263 253
q15 564 526 524 524
q16 509 471 481 471
q17 1896 1864 1863 1863
q18 8710 8305 8161 8161
q19 1714 1759 1741 1741
q20 2257 1950 1938 1938
q21 6537 6191 6215 6191
q22 502 442 437 437
Total cold run time: 63914 ms
Total hot run time: 60731 ms
```
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1865318094
TeamCity be ut coverage result:
Function Coverage: 36.44% (8538/23430)
Line Coverage: 28.53% (69410/243269)
Region Coverage: 27.57% (35920/130295)
Branch Coverage: 24.30% (18354/75534)
Coverage Report: http://coverage.selectdb-in.cc/coverage/e9a020cbd6ccaf66073dc4f03d8e7516085669c8_e9a020cbd6ccaf66073dc4f03d8e7516085669c8/report/index.html
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1435904739
##########
be/src/vec/exec/scan/new_olap_scan_node.cpp:
##########
@@ -508,48 +503,103 @@ Status NewOlapScanNode::_init_scanners(std::list<VScannerSPtr>* scanners) {
std::vector<std::pair<BaseTabletSPtr, int64_t /* version */>> tablets_to_scan;
tablets_to_scan.reserve(_scan_ranges.size());
+ std::vector<TabletWithVersion> tablets;
+
for (auto&& scan_range : _scan_ranges) {
auto tablet = DORIS_TRY(ExecEnv::get_tablet(scan_range->tablet_id));
int64_t version = 0;
std::from_chars(scan_range->version.data(),
scan_range->version.data() + scan_range->version.size(), version);
+ tablets.emplace_back(
+ TabletWithVersion {std::dynamic_pointer_cast<Tablet>(tablet), version});
tablets_to_scan.emplace_back(std::move(tablet), version);
}
+ bool is_dup_mow_key = true;
+ bool unique_keys_with_mor = false;
+ bool enable_parallel_scan = _state->enable_parallel_scan();
+
// Split tablet segment by scanner, only use in pipeline in duplicate key
// 1. if tablet count lower than scanner thread num, count segment num of all tablet ready for scan
// TODO: some tablet may do not have segment, may need split segment all case
if (_shared_scan_opt && _scan_ranges.size() < config::doris_scanner_thread_pool_thread_num) {
for (auto&& [tablet, version] : tablets_to_scan) {
- is_dup_mow_key =
+ unique_keys_with_mor |= tablet->keys_type() == UNIQUE_KEYS &&
+ !tablet->enable_unique_key_merge_on_write();
+ is_dup_mow_key &=
tablet->keys_type() == DUP_KEYS || (tablet->keys_type() == UNIQUE_KEYS &&
tablet->enable_unique_key_merge_on_write());
- if (!is_dup_mow_key) {
- break;
- }
+ if (is_dup_mow_key) {
+ auto& read_source = tablets_read_source.emplace_back();
+ {
+ std::shared_lock rdlock(tablet->get_header_lock());
+ auto st =
+ tablet->capture_rs_readers({0, version}, &read_source.rs_splits, false);
+ if (!st.ok()) {
+ LOG(WARNING) << "fail to init reader.res=" << st;
+ return Status::InternalError(
+ "failed to initialize storage reader. tablet_id={} : {}",
+ tablet->tablet_id(), st.to_string());
+ }
+ }
+ if (!_state->skip_delete_predicate()) {
+ read_source.fill_delete_predicates();
+ }
- auto& read_source = tablets_read_source.emplace_back();
- {
- std::shared_lock rdlock(tablet->get_header_lock());
- auto st = tablet->capture_rs_readers({0, version}, &read_source.rs_splits, false);
- if (!st.ok()) {
- LOG(WARNING) << "fail to init reader.res=" << st;
- return Status::InternalError(
- "failed to initialize storage reader. tablet_id={} : {}",
- tablet->tablet_id(), st.to_string());
+ auto& rs_seg_count = tablet_rs_seg_count.emplace_back();
+ for (const auto& rowset_splits : read_source.rs_splits) {
+ auto num_segments = rowset_splits.rs_reader->rowset()->num_segments();
+ rs_seg_count.emplace_back(num_segments);
+ segment_count += num_segments;
}
}
- if (!_state->skip_delete_predicate()) {
- read_source.fill_delete_predicates();
- }
+ }
+ } else {
+ // To avoid each instance of ScanNode generating too many scanners,
+ // only enable parallel scan when `_shared_scan_opt` is true.
+ enable_parallel_scan = false;
+ is_dup_mow_key = false;
+ }
- auto& rs_seg_count = tablet_rs_seg_count.emplace_back();
- for (const auto& rowset_splits : read_source.rs_splits) {
- auto num_segments = rowset_splits.rs_reader->rowset()->num_segments();
- rs_seg_count.emplace_back(num_segments);
- segment_count += num_segments;
+ bool has_cpu_limit = _state->query_options().__isset.resource_limit &&
+ _state->query_options().resource_limit.__isset.cpu_limit;
+ if (!has_cpu_limit && !should_run_serial() && !unique_keys_with_mor && enable_parallel_scan &&
Review Comment:
这里unique key mor的就不支持了吗?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1858809383
(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 44.37 seconds
stream load tsv: 579 seconds loaded 74807831229 Bytes, about 123 MB/s
stream load json: 19 seconds loaded 2358488459 Bytes, about 118 MB/s
stream load orc: 66 seconds loaded 1101869774 Bytes, about 15 MB/s
stream load parquet: 32 seconds loaded 861443392 Bytes, about 25 MB/s
insert into select: 28.8 seconds inserted 10000000 Rows, about 347K ops/s
storage size: 17221017113 Bytes
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) parallel scan on dup/mow mode [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1857997215
(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 44.7 seconds
stream load tsv: 584 seconds loaded 74807831229 Bytes, about 122 MB/s
stream load json: 19 seconds loaded 2358488459 Bytes, about 118 MB/s
stream load orc: 66 seconds loaded 1101869774 Bytes, about 15 MB/s
stream load parquet: 32 seconds loaded 861443392 Bytes, about 25 MB/s
insert into select: 28.6 seconds inserted 10000000 Rows, about 349K ops/s
storage size: 17219655371 Bytes
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "mrhhsg (via GitHub)" <gi...@apache.org>.
mrhhsg commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1864004857
run buildall
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1864102548
(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 44.47 seconds
stream load tsv: 580 seconds loaded 74807831229 Bytes, about 123 MB/s
stream load json: 19 seconds loaded 2358488459 Bytes, about 118 MB/s
stream load orc: 67 seconds loaded 1101869774 Bytes, about 15 MB/s
stream load parquet: 33 seconds loaded 861443392 Bytes, about 24 MB/s
insert into select: 28.9 seconds inserted 10000000 Rows, about 346K ops/s
storage size: 17184099445 Bytes
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1418537513
##########
be/src/olap/parallel_scanner_builder.cpp:
##########
@@ -0,0 +1,170 @@
+// 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 "parallel_scanner_builder.h"
+
+#include "olap/rowset/beta_rowset.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
Review Comment:
70 tablet --> 1 tablet , other 1000 rows
48 scanner
1 tablet ----> 48 scanner
69 tablet---> 69 scanner
117 scanner ---> queue/ stack
1 scanner thread
1 scanner --> 1000 block 2000rows
1 scanner
2 scanner
scanner thread pool
48
10 scanner ---> queue/ stack
##########
be/src/vec/exec/scan/new_olap_scan_node.cpp:
##########
@@ -508,48 +503,87 @@ Status NewOlapScanNode::_init_scanners(std::list<VScannerSPtr>* scanners) {
std::vector<std::pair<BaseTabletSPtr, int64_t /* version */>> tablets_to_scan;
tablets_to_scan.reserve(_scan_ranges.size());
+ std::vector<TabletWithVersion> tablets;
+
for (auto&& scan_range : _scan_ranges) {
auto tablet = DORIS_TRY(ExecEnv::get_tablet(scan_range->tablet_id));
int64_t version = 0;
std::from_chars(scan_range->version.data(),
scan_range->version.data() + scan_range->version.size(), version);
+ tablets.emplace_back(
+ TabletWithVersion {std::dynamic_pointer_cast<Tablet>(tablet), version});
tablets_to_scan.emplace_back(std::move(tablet), version);
}
+ bool is_dup_mow_key = true;
+ bool unique_keys_with_mor = false;
+ bool enable_parallel_scan = _state->query_options().__isset.enable_parallel_scan &&
Review Comment:
add a function in runtime_state named enable_paralle_scan() not use query optioins directly.
##########
be/src/olap/parallel_scanner_builder.h:
##########
@@ -0,0 +1,120 @@
+// 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.
+
+#pragma once
+
+#include <memory>
+#include <string>
+#include <utility>
+
+#include "olap/reader.h"
+#include "olap/rowset/segment_v2/row_ranges.h"
+#include "olap/segment_loader.h"
+#include "olap/tablet.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
+namespace vectorized {
+class VScanner;
+}
+
+using TabletSPtr = std::shared_ptr<Tablet>;
+using VScannerSPtr = std::shared_ptr<vectorized::VScanner>;
+
+struct TabletWithVersion {
+ TabletSPtr tablet;
+ int64_t version;
+};
+
+struct SegmentGroup {
+ RowsetSharedPtr rowset;
+ std::vector<Segment*> segments;
+ size_t num_blocks;
+ size_t num_rows;
+ std::string min_key;
+ std::string max_key;
+};
+
+template <typename ParentType>
+class ParallelScannerBuilder {
+public:
+ ParallelScannerBuilder(ParentType* parent, const std::vector<TabletWithVersion>& tablets,
+ const std::shared_ptr<RuntimeProfile>& profile,
+ const std::vector<OlapScanRange*>& key_ranges, RuntimeState* state,
+ int64_t limit_per_scanner, bool is_dup_mow_key, bool is_preaggregation)
+ : _parent(parent),
+ _scanner_profile(profile),
+ _state(state),
+ _limit_per_scanner(limit_per_scanner),
+ _is_dup_mow_key(is_dup_mow_key),
+ _is_preaggregation(is_preaggregation),
+ _tablets(tablets.cbegin(), tablets.cend()),
+ _key_ranges(key_ranges.cbegin(), key_ranges.cend()) {}
+
+ Status build_scanners(std::list<VScannerSPtr>& scanners);
+
+ void set_max_scanners_count(size_t count) { _max_scanners_count = count; }
+
+private:
+ Status _load();
+
+ Status _build_scanners_by_rowid(std::list<VScannerSPtr>& scanners);
+
+ Status _build_scanners_by_key_range(std::list<VScannerSPtr>& scanners);
+
+ std::unique_ptr<SegmentGroup> _create_segment_group_from_rowsets(
+ const std::vector<RowsetSharedPtr>& rowsets);
+
+ Status _parse_segment_group(SegmentGroup& group);
+
+ Status _convert_key_ranges(const TabletSPtr& tablet, std::vector<std::string>& start_keys,
+ std::vector<std::string>& end_keys,
+ std::vector<bool>& include_begin_keys,
+ std::vector<bool>& include_end_keys,
+ std::shared_ptr<Schema>& schema);
+
+ std::shared_ptr<vectorized::NewOlapScanner> _build_scanner(
+ BaseTabletSPtr tablet, int64_t version, const std::vector<OlapScanRange*>& key_ranges,
+ TabletReader::ReadSource&& read_source);
+
+ ParentType* _parent;
+
+ /// Max scanners count limit to build
+ size_t _max_scanners_count {16};
+
+ /// Min rows per scanner
+ size_t _min_rows_per_scanner {2 * 1024 * 1024};
Review Comment:
set it as session variable
##########
be/src/olap/parallel_scanner_builder.h:
##########
@@ -0,0 +1,120 @@
+// 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.
+
+#pragma once
+
+#include <memory>
+#include <string>
+#include <utility>
+
+#include "olap/reader.h"
+#include "olap/rowset/segment_v2/row_ranges.h"
+#include "olap/segment_loader.h"
+#include "olap/tablet.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
+namespace vectorized {
+class VScanner;
+}
+
+using TabletSPtr = std::shared_ptr<Tablet>;
+using VScannerSPtr = std::shared_ptr<vectorized::VScanner>;
+
+struct TabletWithVersion {
+ TabletSPtr tablet;
+ int64_t version;
+};
+
+struct SegmentGroup {
+ RowsetSharedPtr rowset;
+ std::vector<Segment*> segments;
+ size_t num_blocks;
+ size_t num_rows;
+ std::string min_key;
+ std::string max_key;
+};
+
+template <typename ParentType>
+class ParallelScannerBuilder {
+public:
+ ParallelScannerBuilder(ParentType* parent, const std::vector<TabletWithVersion>& tablets,
+ const std::shared_ptr<RuntimeProfile>& profile,
+ const std::vector<OlapScanRange*>& key_ranges, RuntimeState* state,
+ int64_t limit_per_scanner, bool is_dup_mow_key, bool is_preaggregation)
+ : _parent(parent),
+ _scanner_profile(profile),
+ _state(state),
+ _limit_per_scanner(limit_per_scanner),
+ _is_dup_mow_key(is_dup_mow_key),
+ _is_preaggregation(is_preaggregation),
+ _tablets(tablets.cbegin(), tablets.cend()),
+ _key_ranges(key_ranges.cbegin(), key_ranges.cend()) {}
+
+ Status build_scanners(std::list<VScannerSPtr>& scanners);
+
+ void set_max_scanners_count(size_t count) { _max_scanners_count = count; }
+
+private:
+ Status _load();
+
+ Status _build_scanners_by_rowid(std::list<VScannerSPtr>& scanners);
+
+ Status _build_scanners_by_key_range(std::list<VScannerSPtr>& scanners);
+
+ std::unique_ptr<SegmentGroup> _create_segment_group_from_rowsets(
+ const std::vector<RowsetSharedPtr>& rowsets);
+
+ Status _parse_segment_group(SegmentGroup& group);
+
+ Status _convert_key_ranges(const TabletSPtr& tablet, std::vector<std::string>& start_keys,
+ std::vector<std::string>& end_keys,
+ std::vector<bool>& include_begin_keys,
+ std::vector<bool>& include_end_keys,
+ std::shared_ptr<Schema>& schema);
+
+ std::shared_ptr<vectorized::NewOlapScanner> _build_scanner(
+ BaseTabletSPtr tablet, int64_t version, const std::vector<OlapScanRange*>& key_ranges,
+ TabletReader::ReadSource&& read_source);
+
+ ParentType* _parent;
+
+ /// Max scanners count limit to build
+ size_t _max_scanners_count {16};
+
+ /// Min rows per scanner
+ size_t _min_rows_per_scanner {2 * 1024 * 1024};
+
+ size_t _total_rows {};
+
+ size_t _rows_per_scanners {_min_rows_per_scanner};
Review Comment:
_rows_per_scanner
##########
be/src/vec/exec/scan/new_olap_scan_node.cpp:
##########
@@ -508,48 +503,87 @@ Status NewOlapScanNode::_init_scanners(std::list<VScannerSPtr>* scanners) {
std::vector<std::pair<BaseTabletSPtr, int64_t /* version */>> tablets_to_scan;
tablets_to_scan.reserve(_scan_ranges.size());
+ std::vector<TabletWithVersion> tablets;
+
for (auto&& scan_range : _scan_ranges) {
auto tablet = DORIS_TRY(ExecEnv::get_tablet(scan_range->tablet_id));
int64_t version = 0;
std::from_chars(scan_range->version.data(),
scan_range->version.data() + scan_range->version.size(), version);
+ tablets.emplace_back(
+ TabletWithVersion {std::dynamic_pointer_cast<Tablet>(tablet), version});
tablets_to_scan.emplace_back(std::move(tablet), version);
}
+ bool is_dup_mow_key = true;
+ bool unique_keys_with_mor = false;
+ bool enable_parallel_scan = _state->query_options().__isset.enable_parallel_scan &&
+ _state->query_options().enable_parallel_scan;
+
// Split tablet segment by scanner, only use in pipeline in duplicate key
// 1. if tablet count lower than scanner thread num, count segment num of all tablet ready for scan
// TODO: some tablet may do not have segment, may need split segment all case
if (_shared_scan_opt && _scan_ranges.size() < config::doris_scanner_thread_pool_thread_num) {
for (auto&& [tablet, version] : tablets_to_scan) {
- is_dup_mow_key =
+ unique_keys_with_mor |= tablet->keys_type() == UNIQUE_KEYS &&
Review Comment:
why this is related with shared scan??
##########
be/src/olap/parallel_scanner_builder.cpp:
##########
@@ -0,0 +1,455 @@
+// 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 "parallel_scanner_builder.h"
+
+#include "exec/olap_utils.h"
+#include "olap/iterators.h"
+#include "olap/primary_key_index.h"
+#include "olap/row_cursor.h"
+#include "olap/rowset/beta_rowset.h"
+#include "olap/rowset/segment_v2/segment.h"
+#include "olap/short_key_index.h"
+#include "util/key_util.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
+using namespace vectorized;
+
+using SplitKey = StorageReadOptions::SplitKey;
+using SplitKeyRange = StorageReadOptions::SplitKeyRange;
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::build_scanners(std::list<VScannerSPtr>& scanners) {
+ RETURN_IF_ERROR(_load());
+ if (_is_dup_mow_key) {
+ return _build_scanners_by_rowid(scanners);
+ } else {
+ return _build_scanners_by_key_range(scanners);
+ }
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
+ std::list<VScannerSPtr>& scanners) {
+ DCHECK_GE(_rows_per_scanners, _min_rows_per_scanner);
+ for (auto&& [tablet, version] : _tablets) {
+ DCHECK(_all_rowsets.contains(tablet->tablet_id()));
+ auto& rowsets = _all_rowsets[tablet->tablet_id()];
+
+ TabletReader::ReadSource reade_source_with_delete_info;
+ if (!_state->skip_delete_predicate()) {
+ RETURN_IF_ERROR(tablet->capture_rs_readers(
+ {0, version}, &reade_source_with_delete_info.rs_splits, false));
+ reade_source_with_delete_info.fill_delete_predicates();
+ }
+
+ TabletReader::ReadSource read_source;
+
+ int64_t rows_collected = 0;
+ for (auto& rowset : rowsets) {
+ auto beta_rowset = std::dynamic_pointer_cast<BetaRowset>(rowset);
+ RowsetReaderSharedPtr reader;
+ RETURN_IF_ERROR(beta_rowset->create_reader(&reader));
+ const auto rowset_id = beta_rowset->rowset_id();
+
+ DCHECK(_segment_cache_handles.contains(rowset_id));
+ auto& segment_cache_handle = _segment_cache_handles[rowset_id];
+
+ if (beta_rowset->num_rows() == 0) {
+ continue;
+ }
+
+ const auto& segments = segment_cache_handle.get_segments();
+ int segment_start = 0;
+ auto split = RowSetSplits(reader->clone());
+
+ for (size_t i = 0; i != segments.size(); ++i) {
+ const auto& segment = segments[i];
+ RowRanges row_ranges;
+ const size_t rows_of_segment = segment->num_rows();
+ int64_t offset_in_segment = 0;
+
+ while (offset_in_segment < rows_of_segment) {
+ const int64_t remaining_rows = rows_of_segment - offset_in_segment;
+ auto rows_need = _rows_per_scanners - rows_collected;
+ if (rows_need >= remaining_rows * 0.9) {
+ rows_need = remaining_rows;
+ }
+ DCHECK_LE(rows_need, remaining_rows);
+
+ auto old_count = row_ranges.count();
+ row_ranges.add({offset_in_segment,
+ offset_in_segment + static_cast<int64_t>(rows_need)});
+ DCHECK_EQ(rows_need + old_count, row_ranges.count());
+ rows_collected += rows_need;
+ offset_in_segment += rows_need;
+
+ if (rows_collected >= _rows_per_scanners) { // build a new scanner
+ split.segment_offsets.first = segment_start,
+ split.segment_offsets.second = i + 1;
+ split.segment_row_ranges.emplace_back(std::move(row_ranges));
+
+ DCHECK_EQ(split.segment_offsets.second - split.segment_offsets.first,
+ split.segment_row_ranges.size());
+
+ read_source.rs_splits.emplace_back(std::move(split));
+
+ if (!_state->skip_delete_predicate()) {
+ read_source.fill_delete_predicates();
+ }
+
+ scanners.emplace_back(
+ _build_scanner(tablet, version, _key_ranges,
+ {std::move(read_source.rs_splits),
+ reade_source_with_delete_info.delete_predicates}));
+
+ read_source = TabletReader::ReadSource();
+ split = RowSetSplits(reader->clone());
+ row_ranges = RowRanges();
+
+ segment_start = offset_in_segment < rows_of_segment ? i : i + 1;
+ rows_collected = 0;
+ }
+ }
+
+ if (!row_ranges.is_empty()) {
+ DCHECK_GT(rows_collected, 0);
+ DCHECK_EQ(row_ranges.to(), segment->num_rows());
+ split.segment_row_ranges.emplace_back(std::move(row_ranges));
+ }
+ }
+
+ DCHECK_LE(rows_collected, _rows_per_scanners);
+ if (rows_collected > 0) {
+ split.segment_offsets.first = segment_start;
+ split.segment_offsets.second = segments.size();
+ DCHECK_GT(split.segment_offsets.second, split.segment_offsets.first);
+ DCHECK_EQ(split.segment_row_ranges.size(),
+ split.segment_offsets.second - split.segment_offsets.first);
+ read_source.rs_splits.emplace_back(std::move(split));
+ }
+ } // end `for (auto& rowset : rowsets)`
+
+ DCHECK_LE(rows_collected, _rows_per_scanners);
+ if (rows_collected > 0) {
+ DCHECK_GT(read_source.rs_splits.size(), 0);
+#ifndef NDEBUG
+ for (auto& split : read_source.rs_splits) {
+ DCHECK(split.rs_reader != nullptr);
+ DCHECK_LT(split.segment_offsets.first, split.segment_offsets.second);
+ DCHECK_EQ(split.segment_row_ranges.size(),
+ split.segment_offsets.second - split.segment_offsets.first);
+ }
+#endif
+ scanners.emplace_back(
+ _build_scanner(tablet, version, _key_ranges,
+ {std::move(read_source.rs_splits),
+ reade_source_with_delete_info.delete_predicates}));
+ }
+ }
+
+ return Status::OK();
+}
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_load() {
+ for (auto&& [tablet, version] : _tablets) {
+ const auto tablet_id = tablet->tablet_id();
+ auto& rows = _tablets_rows.emplace_back(0);
Review Comment:
these logic is very difficult to understand.
##########
be/src/vec/exec/scan/new_olap_scan_node.cpp:
##########
@@ -508,48 +503,87 @@ Status NewOlapScanNode::_init_scanners(std::list<VScannerSPtr>* scanners) {
std::vector<std::pair<BaseTabletSPtr, int64_t /* version */>> tablets_to_scan;
tablets_to_scan.reserve(_scan_ranges.size());
+ std::vector<TabletWithVersion> tablets;
+
for (auto&& scan_range : _scan_ranges) {
auto tablet = DORIS_TRY(ExecEnv::get_tablet(scan_range->tablet_id));
int64_t version = 0;
std::from_chars(scan_range->version.data(),
scan_range->version.data() + scan_range->version.size(), version);
+ tablets.emplace_back(
+ TabletWithVersion {std::dynamic_pointer_cast<Tablet>(tablet), version});
tablets_to_scan.emplace_back(std::move(tablet), version);
}
+ bool is_dup_mow_key = true;
+ bool unique_keys_with_mor = false;
+ bool enable_parallel_scan = _state->query_options().__isset.enable_parallel_scan &&
+ _state->query_options().enable_parallel_scan;
+
// Split tablet segment by scanner, only use in pipeline in duplicate key
// 1. if tablet count lower than scanner thread num, count segment num of all tablet ready for scan
// TODO: some tablet may do not have segment, may need split segment all case
if (_shared_scan_opt && _scan_ranges.size() < config::doris_scanner_thread_pool_thread_num) {
for (auto&& [tablet, version] : tablets_to_scan) {
- is_dup_mow_key =
+ unique_keys_with_mor |= tablet->keys_type() == UNIQUE_KEYS &&
+ !tablet->enable_unique_key_merge_on_write();
+ is_dup_mow_key &=
tablet->keys_type() == DUP_KEYS || (tablet->keys_type() == UNIQUE_KEYS &&
tablet->enable_unique_key_merge_on_write());
- if (!is_dup_mow_key) {
- break;
- }
+ if (is_dup_mow_key) {
+ auto& read_source = tablets_read_source.emplace_back();
+ {
+ std::shared_lock rdlock(tablet->get_header_lock());
+ auto st =
+ tablet->capture_rs_readers({0, version}, &read_source.rs_splits, false);
+ if (!st.ok()) {
+ LOG(WARNING) << "fail to init reader.res=" << st;
+ return Status::InternalError(
+ "failed to initialize storage reader. tablet_id={} : {}",
+ tablet->tablet_id(), st.to_string());
+ }
+ }
+ if (!_state->skip_delete_predicate()) {
+ read_source.fill_delete_predicates();
+ }
- auto& read_source = tablets_read_source.emplace_back();
- {
- std::shared_lock rdlock(tablet->get_header_lock());
- auto st = tablet->capture_rs_readers({0, version}, &read_source.rs_splits, false);
- if (!st.ok()) {
- LOG(WARNING) << "fail to init reader.res=" << st;
- return Status::InternalError(
- "failed to initialize storage reader. tablet_id={} : {}",
- tablet->tablet_id(), st.to_string());
+ auto& rs_seg_count = tablet_rs_seg_count.emplace_back();
+ for (const auto& rowset_splits : read_source.rs_splits) {
+ auto num_segments = rowset_splits.rs_reader->rowset()->num_segments();
+ rs_seg_count.emplace_back(num_segments);
+ segment_count += num_segments;
}
}
- if (!_state->skip_delete_predicate()) {
- read_source.fill_delete_predicates();
- }
+ }
+ } else {
+ enable_parallel_scan = false;
+ is_dup_mow_key = false;
+ }
- auto& rs_seg_count = tablet_rs_seg_count.emplace_back();
- for (const auto& rowset_splits : read_source.rs_splits) {
- auto num_segments = rowset_splits.rs_reader->rowset()->num_segments();
- rs_seg_count.emplace_back(num_segments);
- segment_count += num_segments;
+ if (!unique_keys_with_mor && enable_parallel_scan && _push_down_agg_type == TPushAggOp::NONE) {
+ std::vector<OlapScanRange*> key_ranges;
+ for (auto& range : _cond_ranges) {
+ if (range->begin_scan_range.size() == 1 &&
+ range->begin_scan_range.get_value(0) == NEGATIVE_INFINITY) {
+ continue;
}
+ key_ranges.emplace_back(range.get());
+ }
+
+ ParallelScannerBuilder<NewOlapScanNode> scanner_builder(
+ this, tablets, _scanner_profile, key_ranges, _state, _limit_per_scanner,
+ is_dup_mow_key, _olap_scan_node.is_preaggregation);
+
+ scanner_builder.set_max_scanners_count(config::doris_scanner_thread_pool_thread_num);
Review Comment:
use a session variable to control the max scanner num
##########
be/src/olap/parallel_scanner_builder.cpp:
##########
@@ -0,0 +1,455 @@
+// 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 "parallel_scanner_builder.h"
+
+#include "exec/olap_utils.h"
+#include "olap/iterators.h"
+#include "olap/primary_key_index.h"
+#include "olap/row_cursor.h"
+#include "olap/rowset/beta_rowset.h"
+#include "olap/rowset/segment_v2/segment.h"
+#include "olap/short_key_index.h"
+#include "util/key_util.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
+using namespace vectorized;
+
+using SplitKey = StorageReadOptions::SplitKey;
+using SplitKeyRange = StorageReadOptions::SplitKeyRange;
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::build_scanners(std::list<VScannerSPtr>& scanners) {
+ RETURN_IF_ERROR(_load());
+ if (_is_dup_mow_key) {
+ return _build_scanners_by_rowid(scanners);
+ } else {
+ return _build_scanners_by_key_range(scanners);
+ }
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
+ std::list<VScannerSPtr>& scanners) {
+ DCHECK_GE(_rows_per_scanners, _min_rows_per_scanner);
+ for (auto&& [tablet, version] : _tablets) {
+ DCHECK(_all_rowsets.contains(tablet->tablet_id()));
+ auto& rowsets = _all_rowsets[tablet->tablet_id()];
+
+ TabletReader::ReadSource reade_source_with_delete_info;
+ if (!_state->skip_delete_predicate()) {
+ RETURN_IF_ERROR(tablet->capture_rs_readers(
+ {0, version}, &reade_source_with_delete_info.rs_splits, false));
+ reade_source_with_delete_info.fill_delete_predicates();
+ }
+
+ TabletReader::ReadSource read_source;
+
+ int64_t rows_collected = 0;
+ for (auto& rowset : rowsets) {
+ auto beta_rowset = std::dynamic_pointer_cast<BetaRowset>(rowset);
+ RowsetReaderSharedPtr reader;
+ RETURN_IF_ERROR(beta_rowset->create_reader(&reader));
+ const auto rowset_id = beta_rowset->rowset_id();
+
+ DCHECK(_segment_cache_handles.contains(rowset_id));
+ auto& segment_cache_handle = _segment_cache_handles[rowset_id];
+
+ if (beta_rowset->num_rows() == 0) {
+ continue;
+ }
+
+ const auto& segments = segment_cache_handle.get_segments();
+ int segment_start = 0;
+ auto split = RowSetSplits(reader->clone());
+
+ for (size_t i = 0; i != segments.size(); ++i) {
+ const auto& segment = segments[i];
+ RowRanges row_ranges;
+ const size_t rows_of_segment = segment->num_rows();
+ int64_t offset_in_segment = 0;
+
+ while (offset_in_segment < rows_of_segment) {
+ const int64_t remaining_rows = rows_of_segment - offset_in_segment;
+ auto rows_need = _rows_per_scanners - rows_collected;
+ if (rows_need >= remaining_rows * 0.9) {
+ rows_need = remaining_rows;
+ }
+ DCHECK_LE(rows_need, remaining_rows);
+
+ auto old_count = row_ranges.count();
+ row_ranges.add({offset_in_segment,
Review Comment:
add comment to describe the row range structure
for example, it is [offset, length] ? or [start_offset, end_offset) or [start_offset, end_offset] ?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "jacktengg (via GitHub)" <gi...@apache.org>.
jacktengg commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1431178908
##########
be/src/olap/parallel_scanner_builder.cpp:
##########
@@ -0,0 +1,455 @@
+// 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 "parallel_scanner_builder.h"
+
+#include "exec/olap_utils.h"
+#include "olap/iterators.h"
+#include "olap/primary_key_index.h"
+#include "olap/row_cursor.h"
+#include "olap/rowset/beta_rowset.h"
+#include "olap/rowset/segment_v2/segment.h"
+#include "olap/short_key_index.h"
+#include "util/key_util.h"
+#include "vec/exec/scan/new_olap_scanner.h"
+
+namespace doris {
+
+using namespace vectorized;
+
+using SplitKey = StorageReadOptions::SplitKey;
+using SplitKeyRange = StorageReadOptions::SplitKeyRange;
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::build_scanners(std::list<VScannerSPtr>& scanners) {
+ RETURN_IF_ERROR(_load());
+ if (_is_dup_mow_key) {
+ return _build_scanners_by_rowid(scanners);
+ } else {
+ return _build_scanners_by_key_range(scanners);
+ }
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_rowid(
+ std::list<VScannerSPtr>& scanners) {
+ DCHECK_GE(_rows_per_scanners, _min_rows_per_scanner);
+ for (auto&& [tablet, version] : _tablets) {
+ DCHECK(_all_rowsets.contains(tablet->tablet_id()));
+ auto& rowsets = _all_rowsets[tablet->tablet_id()];
+
+ TabletReader::ReadSource reade_source_with_delete_info;
+ if (!_state->skip_delete_predicate()) {
+ RETURN_IF_ERROR(tablet->capture_rs_readers(
+ {0, version}, &reade_source_with_delete_info.rs_splits, false));
+ reade_source_with_delete_info.fill_delete_predicates();
+ }
+
+ TabletReader::ReadSource read_source;
+
+ int64_t rows_collected = 0;
+ for (auto& rowset : rowsets) {
+ auto beta_rowset = std::dynamic_pointer_cast<BetaRowset>(rowset);
+ RowsetReaderSharedPtr reader;
+ RETURN_IF_ERROR(beta_rowset->create_reader(&reader));
+ const auto rowset_id = beta_rowset->rowset_id();
+
+ DCHECK(_segment_cache_handles.contains(rowset_id));
+ auto& segment_cache_handle = _segment_cache_handles[rowset_id];
+
+ if (beta_rowset->num_rows() == 0) {
+ continue;
+ }
+
+ const auto& segments = segment_cache_handle.get_segments();
+ int segment_start = 0;
+ auto split = RowSetSplits(reader->clone());
+
+ for (size_t i = 0; i != segments.size(); ++i) {
+ const auto& segment = segments[i];
+ RowRanges row_ranges;
+ const size_t rows_of_segment = segment->num_rows();
+ int64_t offset_in_segment = 0;
+
+ while (offset_in_segment < rows_of_segment) {
+ const int64_t remaining_rows = rows_of_segment - offset_in_segment;
+ auto rows_need = _rows_per_scanners - rows_collected;
+ if (rows_need >= remaining_rows * 0.9) {
+ rows_need = remaining_rows;
+ }
+ DCHECK_LE(rows_need, remaining_rows);
+
+ auto old_count = row_ranges.count();
+ row_ranges.add({offset_in_segment,
+ offset_in_segment + static_cast<int64_t>(rows_need)});
+ DCHECK_EQ(rows_need + old_count, row_ranges.count());
+ rows_collected += rows_need;
+ offset_in_segment += rows_need;
+
+ if (rows_collected >= _rows_per_scanners) { // build a new scanner
+ split.segment_offsets.first = segment_start,
+ split.segment_offsets.second = i + 1;
+ split.segment_row_ranges.emplace_back(std::move(row_ranges));
+
+ DCHECK_EQ(split.segment_offsets.second - split.segment_offsets.first,
+ split.segment_row_ranges.size());
+
+ read_source.rs_splits.emplace_back(std::move(split));
+
+ if (!_state->skip_delete_predicate()) {
+ read_source.fill_delete_predicates();
+ }
+
+ scanners.emplace_back(
+ _build_scanner(tablet, version, _key_ranges,
+ {std::move(read_source.rs_splits),
+ reade_source_with_delete_info.delete_predicates}));
+
+ read_source = TabletReader::ReadSource();
+ split = RowSetSplits(reader->clone());
+ row_ranges = RowRanges();
+
+ segment_start = offset_in_segment < rows_of_segment ? i : i + 1;
+ rows_collected = 0;
+ }
+ }
+
+ if (!row_ranges.is_empty()) {
+ DCHECK_GT(rows_collected, 0);
+ DCHECK_EQ(row_ranges.to(), segment->num_rows());
+ split.segment_row_ranges.emplace_back(std::move(row_ranges));
+ }
+ }
+
+ DCHECK_LE(rows_collected, _rows_per_scanners);
+ if (rows_collected > 0) {
+ split.segment_offsets.first = segment_start;
+ split.segment_offsets.second = segments.size();
+ DCHECK_GT(split.segment_offsets.second, split.segment_offsets.first);
+ DCHECK_EQ(split.segment_row_ranges.size(),
+ split.segment_offsets.second - split.segment_offsets.first);
+ read_source.rs_splits.emplace_back(std::move(split));
+ }
+ } // end `for (auto& rowset : rowsets)`
+
+ DCHECK_LE(rows_collected, _rows_per_scanners);
+ if (rows_collected > 0) {
+ DCHECK_GT(read_source.rs_splits.size(), 0);
+#ifndef NDEBUG
+ for (auto& split : read_source.rs_splits) {
+ DCHECK(split.rs_reader != nullptr);
+ DCHECK_LT(split.segment_offsets.first, split.segment_offsets.second);
+ DCHECK_EQ(split.segment_row_ranges.size(),
+ split.segment_offsets.second - split.segment_offsets.first);
+ }
+#endif
+ scanners.emplace_back(
+ _build_scanner(tablet, version, _key_ranges,
+ {std::move(read_source.rs_splits),
+ reade_source_with_delete_info.delete_predicates}));
+ }
+ }
+
+ return Status::OK();
+}
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_load() {
+ for (auto&& [tablet, version] : _tablets) {
+ const auto tablet_id = tablet->tablet_id();
+ auto& rows = _tablets_rows.emplace_back(0);
+ auto& rowsets = _all_rowsets[tablet_id];
+ RETURN_IF_ERROR(tablet->capture_consistent_rowsets({0, version}, &rowsets));
+
+ for (auto& rowset : rowsets) {
+ RETURN_IF_ERROR(rowset->load());
+ const auto rowset_id = rowset->rowset_id();
+ auto& segment_cache_handle = _segment_cache_handles[rowset_id];
+
+ RETURN_IF_ERROR(SegmentLoader::instance()->load_segments(
+ std::dynamic_pointer_cast<BetaRowset>(rowset), &segment_cache_handle, true));
+ _total_rows += rowset->num_rows();
+ rows += _total_rows;
+ }
+ }
+
+ _rows_per_scanners = _total_rows / _max_scanners_count;
+ _rows_per_scanners = std::max<size_t>(_rows_per_scanners, _min_rows_per_scanner);
+
+ return Status::OK();
+}
+
+template <typename ParentType>
+std::unique_ptr<SegmentGroup>
+ParallelScannerBuilder<ParentType>::_create_segment_group_from_rowsets(
+ const std::vector<RowsetSharedPtr>& rowsets) {
+ if (rowsets.empty()) {
+ return {};
+ }
+
+ size_t max_rows = 0;
+ auto segment_group = std::make_unique<SegmentGroup>();
+ for (const auto& rowset : rowsets) {
+ const auto rowset_id = rowset->rowset_id();
+ DCHECK(_segment_cache_handles.contains(rowset_id));
+ auto& cache_handle = _segment_cache_handles[rowset_id];
+ auto& segments = cache_handle.get_segments();
+
+ if (segments.empty()) {
+ continue;
+ }
+
+ if (rowset->is_segments_overlapping()) {
+ auto* largest_segment = segments[0].get();
+ for (size_t i = 1; i != segments.size(); ++i) {
+ if (segments[i]->num_rows() > largest_segment->num_rows()) {
+ largest_segment = segments[i].get();
+ }
+ }
+
+ if (largest_segment->num_rows() > max_rows) {
+ segment_group->rowset = rowset;
+ segment_group->num_rows = largest_segment->num_rows();
+ segment_group->segments.clear();
+ segment_group->segments.emplace_back(largest_segment);
+ max_rows = largest_segment->num_rows();
+ }
+ } else if (rowset->num_rows() > max_rows) {
+ max_rows = rowset->num_rows();
+ segment_group->rowset = rowset;
+ segment_group->segments.clear();
+ segment_group->segments.reserve(segments.size());
+ segment_group->num_rows = 0;
+ for (auto& segment : segments) {
+ segment_group->num_rows += segment->num_rows();
+ segment_group->segments.emplace_back(segment.get());
+ }
+ }
+ }
+
+ if (max_rows == 0) {
+ return {};
+ }
+
+ DCHECK(segment_group->rowset != nullptr);
+ return segment_group;
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_parse_segment_group(SegmentGroup& group) {
+ for (auto* segment : group.segments) {
+ RETURN_IF_ERROR(segment->load_index());
+ const ShortKeyIndexDecoder* index = segment->get_short_key_index();
+ group.num_blocks += index->num_items();
+ }
+ return Status::OK();
+}
+
+template <typename ParentType>
+std::shared_ptr<NewOlapScanner> ParallelScannerBuilder<ParentType>::_build_scanner(
+ BaseTabletSPtr tablet, int64_t version, const std::vector<OlapScanRange*>& key_ranges,
+ TabletReader::ReadSource&& read_source) {
+ NewOlapScanner::Params params {
+ _state, _scanner_profile.get(), key_ranges, std::move(tablet),
+ version, std::move(read_source), _limit_per_scanner, _is_preaggregation};
+ return NewOlapScanner::create_shared(_parent, std::move(params));
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_convert_key_ranges(
+ const TabletSPtr& tablet, std::vector<std::string>& start_keys,
+ std::vector<std::string>& end_keys, std::vector<bool>& include_begin_keys,
+ std::vector<bool>& include_end_keys, std::shared_ptr<Schema>& schema) {
+ DCHECK(start_keys.empty());
+ DCHECK(end_keys.empty());
+
+ TabletSchemaSPtr tablet_schema = tablet->tablet_schema();
+
+ std::vector<uint32_t> columns;
+ if (_key_ranges.empty()) {
+ columns.resize(tablet->num_short_key_columns());
+ } else {
+ DCHECK_EQ(_key_ranges.front()->end_scan_range.size(),
+ _key_ranges.front()->begin_scan_range.size());
+ columns.resize(_key_ranges.front()->end_scan_range.size());
+ }
+
+ std::iota(columns.begin(), columns.end(), 0);
+ schema = std::make_shared<Schema>(tablet_schema->columns(), columns);
+
+ if (_key_ranges.empty()) {
+ start_keys.emplace_back();
+ end_keys.emplace_back();
+ include_begin_keys.emplace_back(true);
+ include_end_keys.emplace_back(true);
+ return Status::OK();
+ }
+
+ for (auto& key_range : _key_ranges) {
+ start_keys.emplace_back();
+ end_keys.emplace_back();
+
+ include_begin_keys.emplace_back(key_range->begin_include);
+ include_end_keys.emplace_back(key_range->end_include);
+
+ RowCursor start_key;
+ RowCursor end_key;
+ RETURN_IF_ERROR(start_key.init_scan_key(tablet->tablet_schema(),
+ key_range->begin_scan_range.values(), schema));
+ RETURN_IF_ERROR(start_key.from_tuple(key_range->begin_scan_range));
+
+ encode_key_with_padding(&start_keys.back(), start_key,
+ tablet_schema->num_short_key_columns(), key_range->begin_include);
+
+ RETURN_IF_ERROR(end_key.init_scan_key(tablet->tablet_schema(),
+ key_range->end_scan_range.values(), schema));
+ RETURN_IF_ERROR(end_key.from_tuple(key_range->end_scan_range));
+
+ encode_key_with_padding(&end_keys.back(), end_key, tablet_schema->num_short_key_columns(),
+ !key_range->end_include);
+ }
+
+ return Status::OK();
+}
+
+template <typename ParentType>
+Status ParallelScannerBuilder<ParentType>::_build_scanners_by_key_range(
+ std::list<VScannerSPtr>& scanners) {
+ for (size_t i = 0; i != _tablets.size(); ++i) {
+ auto& tablet = _tablets[i].tablet;
+ auto version = _tablets[i].version;
+
+ DCHECK(_all_rowsets.contains(tablet->tablet_id()));
+ auto& rowsets = _all_rowsets[tablet->tablet_id()];
+ auto segment_group = _create_segment_group_from_rowsets(rowsets);
+
+ if (!segment_group || segment_group->num_rows == 0) {
+ continue;
+ }
+
+ RETURN_IF_ERROR(_parse_segment_group(*segment_group));
+
+ DCHECK_GE(_tablets_rows[i], segment_group->num_rows);
+
+ TabletSchemaSPtr tablet_schema = tablet->tablet_schema();
+ std::vector<std::string> original_start_keys;
+ std::vector<std::string> original_end_keys;
+ std::vector<bool> original_include_begin_keys;
+ std::vector<bool> original_include_end_keys;
+
+ std::vector<SplitKeyRange> split_ranges;
+
+ std::shared_ptr<Schema> key_column_schema;
+ RETURN_IF_ERROR(_convert_key_ranges(tablet, original_start_keys, original_end_keys,
+ original_include_begin_keys, original_include_end_keys,
+ key_column_schema));
+
+ auto total_blocks_count = segment_group->num_blocks;
+ size_t blocks_per_scanner = total_blocks_count * _rows_per_scanners / _tablets_rows[i];
+ blocks_per_scanner = std::max<size_t>(1, blocks_per_scanner);
+
+ for (size_t key_index = 0; key_index != original_start_keys.size(); ++key_index) {
+ std::string& start_key_string = original_start_keys[key_index];
+ std::string& end_key_string = original_end_keys[key_index];
+ size_t collected_blocks = 0;
+
+ Slice start_key(start_key_string);
+ Slice end_key(end_key_string);
+
+ bool include_begin = original_include_begin_keys[key_index];
+ bool original_end_key_matched = false;
+ for (Segment* segment : segment_group->segments) {
+ const ShortKeyIndexDecoder* key_index_decoder = segment->get_short_key_index();
+
+ auto lower_bound = start_key.empty() ? key_index_decoder->begin()
+ : key_index_decoder->lower_bound(start_key);
+ auto upper_bound = end_key.empty() ? key_index_decoder->end()
+ : key_index_decoder->upper_bound(end_key);
+
+ if (!lower_bound.valid() || lower_bound.ordinal() > upper_bound.ordinal()) {
Review Comment:
Add comment and some examples for better understanding.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "mrhhsg (via GitHub)" <gi...@apache.org>.
mrhhsg commented on PR #28103:
URL: https://github.com/apache/doris/pull/28103#issuecomment-1862499044
run buildall
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1435902129
##########
fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java:
##########
@@ -784,7 +792,19 @@ public class SessionVariable implements Serializable, Writable {
@VariableMgr.VarAttr(name = ENABLE_SHARED_SCAN, fuzzy = false, varType = VariableAnnotation.EXPERIMENTAL,
needForward = true)
- private boolean enableSharedScan = false;
+ private boolean enableSharedScan = true;
Review Comment:
不要改这个默认值,我们默认把池化关闭了。 等稳定了再打开。
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1435911380
##########
be/src/vec/exec/scan/new_olap_scan_node.cpp:
##########
@@ -508,48 +503,103 @@ Status NewOlapScanNode::_init_scanners(std::list<VScannerSPtr>* scanners) {
std::vector<std::pair<BaseTabletSPtr, int64_t /* version */>> tablets_to_scan;
tablets_to_scan.reserve(_scan_ranges.size());
+ std::vector<TabletWithVersion> tablets;
+
for (auto&& scan_range : _scan_ranges) {
auto tablet = DORIS_TRY(ExecEnv::get_tablet(scan_range->tablet_id));
int64_t version = 0;
std::from_chars(scan_range->version.data(),
scan_range->version.data() + scan_range->version.size(), version);
+ tablets.emplace_back(
+ TabletWithVersion {std::dynamic_pointer_cast<Tablet>(tablet), version});
tablets_to_scan.emplace_back(std::move(tablet), version);
}
+ bool is_dup_mow_key = true;
+ bool unique_keys_with_mor = false;
+ bool enable_parallel_scan = _state->enable_parallel_scan();
+
// Split tablet segment by scanner, only use in pipeline in duplicate key
// 1. if tablet count lower than scanner thread num, count segment num of all tablet ready for scan
// TODO: some tablet may do not have segment, may need split segment all case
if (_shared_scan_opt && _scan_ranges.size() < config::doris_scanner_thread_pool_thread_num) {
for (auto&& [tablet, version] : tablets_to_scan) {
- is_dup_mow_key =
+ unique_keys_with_mor |= tablet->keys_type() == UNIQUE_KEYS &&
+ !tablet->enable_unique_key_merge_on_write();
+ is_dup_mow_key &=
tablet->keys_type() == DUP_KEYS || (tablet->keys_type() == UNIQUE_KEYS &&
tablet->enable_unique_key_merge_on_write());
- if (!is_dup_mow_key) {
- break;
- }
+ if (is_dup_mow_key) {
+ auto& read_source = tablets_read_source.emplace_back();
+ {
+ std::shared_lock rdlock(tablet->get_header_lock());
+ auto st =
+ tablet->capture_rs_readers({0, version}, &read_source.rs_splits, false);
+ if (!st.ok()) {
+ LOG(WARNING) << "fail to init reader.res=" << st;
+ return Status::InternalError(
+ "failed to initialize storage reader. tablet_id={} : {}",
+ tablet->tablet_id(), st.to_string());
+ }
+ }
+ if (!_state->skip_delete_predicate()) {
+ read_source.fill_delete_predicates();
+ }
- auto& read_source = tablets_read_source.emplace_back();
- {
- std::shared_lock rdlock(tablet->get_header_lock());
- auto st = tablet->capture_rs_readers({0, version}, &read_source.rs_splits, false);
- if (!st.ok()) {
- LOG(WARNING) << "fail to init reader.res=" << st;
- return Status::InternalError(
- "failed to initialize storage reader. tablet_id={} : {}",
- tablet->tablet_id(), st.to_string());
+ auto& rs_seg_count = tablet_rs_seg_count.emplace_back();
+ for (const auto& rowset_splits : read_source.rs_splits) {
+ auto num_segments = rowset_splits.rs_reader->rowset()->num_segments();
+ rs_seg_count.emplace_back(num_segments);
+ segment_count += num_segments;
}
}
- if (!_state->skip_delete_predicate()) {
- read_source.fill_delete_predicates();
- }
+ }
+ } else {
+ // To avoid each instance of ScanNode generating too many scanners,
+ // only enable parallel scan when `_shared_scan_opt` is true.
+ enable_parallel_scan = false;
+ is_dup_mow_key = false;
+ }
- auto& rs_seg_count = tablet_rs_seg_count.emplace_back();
- for (const auto& rowset_splits : read_source.rs_splits) {
- auto num_segments = rowset_splits.rs_reader->rowset()->num_segments();
- rs_seg_count.emplace_back(num_segments);
- segment_count += num_segments;
+ bool has_cpu_limit = _state->query_options().__isset.resource_limit &&
+ _state->query_options().resource_limit.__isset.cpu_limit;
+ if (!has_cpu_limit && !should_run_serial() && !unique_keys_with_mor && enable_parallel_scan &&
+ _push_down_agg_type == TPushAggOp::NONE) {
+ std::vector<OlapScanRange*> key_ranges;
+ for (auto& range : _cond_ranges) {
+ if (range->begin_scan_range.size() == 1 &&
+ range->begin_scan_range.get_value(0) == NEGATIVE_INFINITY) {
+ continue;
}
+ key_ranges.emplace_back(range.get());
}
+
+ ParallelScannerBuilder<NewOlapScanNode> scanner_builder(
+ this, tablets, _scanner_profile, key_ranges, _state, _limit_per_scanner,
+ is_dup_mow_key, _olap_scan_node.is_preaggregation);
+
+ int max_scanners_count = _state->parallel_scan_max_scanners_count();
+
+ // If the `max_scanners_count` was not set,
+ // use `config::doris_scanner_thread_pool_thread_num` as the default value.
+ if (max_scanners_count == 0) {
Review Comment:
<=
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [feature](scan) Implement parallel scanning by dividing the tablets based on either the row range or the key range. [doris]
Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #28103:
URL: https://github.com/apache/doris/pull/28103#discussion_r1435911178
##########
be/src/vec/exec/scan/new_olap_scan_node.cpp:
##########
@@ -508,48 +503,103 @@ Status NewOlapScanNode::_init_scanners(std::list<VScannerSPtr>* scanners) {
std::vector<std::pair<BaseTabletSPtr, int64_t /* version */>> tablets_to_scan;
tablets_to_scan.reserve(_scan_ranges.size());
+ std::vector<TabletWithVersion> tablets;
+
for (auto&& scan_range : _scan_ranges) {
auto tablet = DORIS_TRY(ExecEnv::get_tablet(scan_range->tablet_id));
int64_t version = 0;
std::from_chars(scan_range->version.data(),
scan_range->version.data() + scan_range->version.size(), version);
+ tablets.emplace_back(
+ TabletWithVersion {std::dynamic_pointer_cast<Tablet>(tablet), version});
tablets_to_scan.emplace_back(std::move(tablet), version);
}
+ bool is_dup_mow_key = true;
+ bool unique_keys_with_mor = false;
+ bool enable_parallel_scan = _state->enable_parallel_scan();
+
// Split tablet segment by scanner, only use in pipeline in duplicate key
// 1. if tablet count lower than scanner thread num, count segment num of all tablet ready for scan
// TODO: some tablet may do not have segment, may need split segment all case
if (_shared_scan_opt && _scan_ranges.size() < config::doris_scanner_thread_pool_thread_num) {
for (auto&& [tablet, version] : tablets_to_scan) {
- is_dup_mow_key =
+ unique_keys_with_mor |= tablet->keys_type() == UNIQUE_KEYS &&
+ !tablet->enable_unique_key_merge_on_write();
+ is_dup_mow_key &=
tablet->keys_type() == DUP_KEYS || (tablet->keys_type() == UNIQUE_KEYS &&
tablet->enable_unique_key_merge_on_write());
- if (!is_dup_mow_key) {
- break;
- }
+ if (is_dup_mow_key) {
+ auto& read_source = tablets_read_source.emplace_back();
+ {
+ std::shared_lock rdlock(tablet->get_header_lock());
+ auto st =
+ tablet->capture_rs_readers({0, version}, &read_source.rs_splits, false);
+ if (!st.ok()) {
+ LOG(WARNING) << "fail to init reader.res=" << st;
+ return Status::InternalError(
+ "failed to initialize storage reader. tablet_id={} : {}",
+ tablet->tablet_id(), st.to_string());
+ }
+ }
+ if (!_state->skip_delete_predicate()) {
+ read_source.fill_delete_predicates();
+ }
- auto& read_source = tablets_read_source.emplace_back();
- {
- std::shared_lock rdlock(tablet->get_header_lock());
- auto st = tablet->capture_rs_readers({0, version}, &read_source.rs_splits, false);
- if (!st.ok()) {
- LOG(WARNING) << "fail to init reader.res=" << st;
- return Status::InternalError(
- "failed to initialize storage reader. tablet_id={} : {}",
- tablet->tablet_id(), st.to_string());
+ auto& rs_seg_count = tablet_rs_seg_count.emplace_back();
+ for (const auto& rowset_splits : read_source.rs_splits) {
+ auto num_segments = rowset_splits.rs_reader->rowset()->num_segments();
+ rs_seg_count.emplace_back(num_segments);
+ segment_count += num_segments;
}
}
- if (!_state->skip_delete_predicate()) {
- read_source.fill_delete_predicates();
- }
+ }
+ } else {
+ // To avoid each instance of ScanNode generating too many scanners,
+ // only enable parallel scan when `_shared_scan_opt` is true.
+ enable_parallel_scan = false;
+ is_dup_mow_key = false;
+ }
- auto& rs_seg_count = tablet_rs_seg_count.emplace_back();
- for (const auto& rowset_splits : read_source.rs_splits) {
- auto num_segments = rowset_splits.rs_reader->rowset()->num_segments();
- rs_seg_count.emplace_back(num_segments);
- segment_count += num_segments;
+ bool has_cpu_limit = _state->query_options().__isset.resource_limit &&
Review Comment:
keyrange [startkey, endkey) ---> [111,123)
1114
1115
1116
1234
1235
1236
--
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.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org