Skip to content

Commit

Permalink
(fix)[meta][export] fix replay export NPE issue (#28752)
Browse files Browse the repository at this point in the history
The ConnectionContext does not exist in replay thread
  • Loading branch information
morningman authored Dec 21, 2023
1 parent 5d8c465 commit 4ddef31
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,12 @@ public ExportStmt(TableRef tableRef, Expr whereExpr, String path,
this.lineDelimiter = DEFAULT_LINE_DELIMITER;
this.timeout = DEFAULT_TIMEOUT;

Optional<SessionVariable> optionalSessionVariable = Optional.ofNullable(
ConnectContext.get().getSessionVariable());
this.sessionVariables = optionalSessionVariable.orElse(VariableMgr.getDefaultSessionVariable());
// ConnectionContext may not exist when in replay thread
if (ConnectContext.get() != null) {
this.sessionVariables = VariableMgr.cloneSessionVariable(ConnectContext.get().getSessionVariable());
} else {
this.sessionVariables = VariableMgr.cloneSessionVariable(VariableMgr.getDefaultSessionVariable());
}
}

@Override
Expand Down

0 comments on commit 4ddef31

Please sign in to comment.