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

morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 36e504ca435bc403c843960e2b4998adbd5b1486
Author: Jibing-Li <64681310+jibing...@users.noreply.github.com>
AuthorDate: Tue Dec 13 11:27:51 2022 +0800

    [fix](multi catalog)Check orc file reader is not null before using it. 
(#14988)
    
    The external table file path cache may out of date, which will cause orc 
reader to visit non-exist files.
    In this case, orc file reader is nullptr.
    This pr is to check the reader before using it to avoid core dump of 
visiting nullptr.
---
 be/src/vec/exec/format/orc/vorc_reader.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/be/src/vec/exec/format/orc/vorc_reader.cpp 
b/be/src/vec/exec/format/orc/vorc_reader.cpp
index 216aa24ec9..538f91e732 100644
--- a/be/src/vec/exec/format/orc/vorc_reader.cpp
+++ b/be/src/vec/exec/format/orc/vorc_reader.cpp
@@ -96,10 +96,12 @@ OrcReader::~OrcReader() {
 void OrcReader::close() {
     if (!_closed) {
         if (_profile != nullptr) {
-            auto& fst = _file_reader->statistics();
-            COUNTER_UPDATE(_orc_profile.read_time, fst.read_time);
-            COUNTER_UPDATE(_orc_profile.read_calls, fst.read_calls);
-            COUNTER_UPDATE(_orc_profile.read_bytes, fst.read_bytes);
+            if (_file_reader != nullptr) {
+                auto& fst = _file_reader->statistics();
+                COUNTER_UPDATE(_orc_profile.read_time, fst.read_time);
+                COUNTER_UPDATE(_orc_profile.read_calls, fst.read_calls);
+                COUNTER_UPDATE(_orc_profile.read_bytes, fst.read_bytes);
+            }
             COUNTER_UPDATE(_orc_profile.column_read_time, 
_statistics.column_read_time);
             COUNTER_UPDATE(_orc_profile.get_batch_time, 
_statistics.get_batch_time);
             COUNTER_UPDATE(_orc_profile.parse_meta_time, 
_statistics.parse_meta_time);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to