This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 299d61bd93d add defensive code in runtime predicate to avoid crash due
to column not in tablet schema #26990 (#26991)
299d61bd93d is described below
commit 299d61bd93d20bef3f978af0e617e030ac1fe413
Author: Kang <[email protected]>
AuthorDate: Tue Nov 14 09:56:08 2023 -0600
add defensive code in runtime predicate to avoid crash due to column not in
tablet schema #26990 (#26991)
---
be/src/runtime/runtime_predicate.cpp | 9 ++++-----
be/src/runtime/runtime_predicate.h | 4 ++--
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/be/src/runtime/runtime_predicate.cpp
b/be/src/runtime/runtime_predicate.cpp
index f053b842c7b..d3deb748cae 100644
--- a/be/src/runtime/runtime_predicate.cpp
+++ b/be/src/runtime/runtime_predicate.cpp
@@ -132,11 +132,6 @@ Status RuntimePredicate::update(const Field& value, const
String& col_name, bool
std::unique_lock<std::shared_mutex> wlock(_rwlock);
- // TODO why null
- if (!_tablet_schema) {
- return Status::OK();
- }
-
bool updated = false;
if (UNLIKELY(_orderby_extrem.is_null())) {
@@ -158,6 +153,10 @@ Status RuntimePredicate::update(const Field& value, const
String& col_name, bool
return Status::OK();
}
+ // TODO defensive code
+ if (!_tablet_schema || !_tablet_schema->have_column(col_name)) {
+ return Status::OK();
+ }
// update _predictate
int32_t col_unique_id = _tablet_schema->column(col_name).unique_id();
const TabletColumn& column = _tablet_schema->column_by_uid(col_unique_id);
diff --git a/be/src/runtime/runtime_predicate.h
b/be/src/runtime/runtime_predicate.h
index 9dd48279acb..fe8fe6add83 100644
--- a/be/src/runtime/runtime_predicate.h
+++ b/be/src/runtime/runtime_predicate.h
@@ -66,8 +66,8 @@ private:
mutable std::shared_mutex _rwlock;
Field _orderby_extrem {Field::Types::Null};
std::shared_ptr<ColumnPredicate> _predictate {nullptr};
- TabletSchemaSPtr _tablet_schema;
- std::unique_ptr<Arena> _predicate_arena;
+ TabletSchemaSPtr _tablet_schema {nullptr};
+ std::unique_ptr<Arena> _predicate_arena {nullptr};
std::function<std::string(const Field&)> _get_value_fn;
bool _nulls_first = true;
bool _inited = false;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]