This is an automated email from the ASF dual-hosted git repository.

eldenmoon 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 0a1a6cf02f1 [fix](topn) add defensive code in topn opt to avoid crash 
due to column not in tablet schema
0a1a6cf02f1 is described below

commit 0a1a6cf02f1c3e596ffdffe3ac480f7f6c13bcb4
Author: Kang <[email protected]>
AuthorDate: Fri Nov 17 07:14:10 2023 -0600

    [fix](topn) add defensive code in topn opt to avoid crash due to column not 
in tablet schema
---
 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 a16984ae707..627e22364e5 100644
--- a/be/src/runtime/runtime_predicate.cpp
+++ b/be/src/runtime/runtime_predicate.cpp
@@ -135,11 +135,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())) {
@@ -161,6 +156,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 b1d4dadf1a4..9607bf37ef7 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]

Reply via email to