This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 58c51086ca [bugfix](topn) fix topn read_orderby_key_columns nullptr
(#16896)
58c51086ca is described below
commit 58c51086ca2ad4af4a2e584cd05d1b43de41b386
Author: Kang <[email protected]>
AuthorDate: Sun Feb 19 23:28:33 2023 +0800
[bugfix](topn) fix topn read_orderby_key_columns nullptr (#16896)
The SQL `SELECT nationkey FROM
regression_test_query_p0_limit.tpch_tiny_nation ORDER BY nationkey DESC LIMIT 5`
make be core dump since dereference a nullptr `read_orderby_key_columns in
VCollectIterator::_topn_next`,
triggered by skipping _colname_to_value_range init in #16818 .
This PR makes two changes:
1. avoid read_orderby_key_columns nullptr in
TabletReader::_init_orderby_keys_param
2. return error if read_orderby_key_columns is nullptr unexpected in
VCollectIterator::_topn_next to avoid core dump
---
be/src/olap/reader.cpp | 4 ----
be/src/vec/olap/vcollect_iterator.cpp | 5 +++++
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/be/src/olap/reader.cpp b/be/src/olap/reader.cpp
index ba828b01be..ecda938052 100644
--- a/be/src/olap/reader.cpp
+++ b/be/src/olap/reader.cpp
@@ -412,10 +412,6 @@ Status TabletReader::_init_keys_param(const ReaderParams&
read_params) {
}
Status TabletReader::_init_orderby_keys_param(const ReaderParams& read_params)
{
- if (read_params.start_key.empty()) {
- return Status::OK();
- }
-
// UNIQUE_KEYS will compare all keys as before
if (_tablet_schema->keys_type() == DUP_KEYS ||
(_tablet_schema->keys_type() == UNIQUE_KEYS &&
_tablet->enable_unique_key_merge_on_write())) {
diff --git a/be/src/vec/olap/vcollect_iterator.cpp
b/be/src/vec/olap/vcollect_iterator.cpp
index 7231ad1453..714c2ffd99 100644
--- a/be/src/vec/olap/vcollect_iterator.cpp
+++ b/be/src/vec/olap/vcollect_iterator.cpp
@@ -245,6 +245,11 @@ Status VCollectIterator::_topn_next(Block* block) {
auto cloneBlock = block->clone_empty();
MutableBlock mutable_block =
vectorized::MutableBlock::build_mutable_block(&cloneBlock);
+ if (!_reader->_reader_context.read_orderby_key_columns) {
+ return Status::Error<ErrorCode::INTERNAL_ERROR>(
+ "read_orderby_key_columns should not be nullptr");
+ }
+
size_t first_sort_column_idx =
(*_reader->_reader_context.read_orderby_key_columns)[0];
const std::vector<uint32_t>* sort_columns =
_reader->_reader_context.read_orderby_key_columns;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]