diff --git a/be/src/exec/tablet_sink.cpp b/be/src/exec/tablet_sink.cpp index 3be046a1c8069d..9cbdf76959e02f 100644 --- a/be/src/exec/tablet_sink.cpp +++ b/be/src/exec/tablet_sink.cpp @@ -588,9 +588,12 @@ Status OlapTableSink::send(RuntimeState* state, RowBatch* input_batch) { } Status OlapTableSink::close(RuntimeState* state, Status close_status) { - SCOPED_TIMER(_profile->total_time_counter()); Status status = close_status; if (status.ok()) { + // SCOPED_TIMER should only be called is status is ok. + // if status is not ok, this OlapTableSink may not be prepared, + // so the `_profile` may be null. + SCOPED_TIMER(_profile->total_time_counter()); { SCOPED_TIMER(_close_timer); for (auto channel : _channels) {