[fix](Export) fix some issues of Export (#34345)
1. Forbid rollback to the old optimizer in `Export` task. Since originStmt is empty, reverting to the old optimizer when the new optimizer is enabled is meaningless. 2. Display `parallelism` in 'show export'. 3. Create an initial Map for resultAttachedInfo to avoid NullPointerException. 4. Remove the originStmt added in this PR #31020, because the `Export` statement is underlying the Outfile statement, it cannot be treated as `OriginStmt`.
This commit is contained in:
@ -384,6 +384,7 @@ public class ExportMgr {
|
||||
infoMap.put("tablet_num", job.getTabletsNum());
|
||||
infoMap.put("max_file_size", job.getMaxFileSize());
|
||||
infoMap.put("delete_existing_files", job.getDeleteExistingFiles());
|
||||
infoMap.put("parallelism", job.getParallelism());
|
||||
infoMap.put("data_consistency", job.getDataConsistency());
|
||||
jobInfo.add(new Gson().toJson(infoMap));
|
||||
// path
|
||||
|
||||
@ -33,7 +33,6 @@ import org.apache.doris.nereids.glue.LogicalPlanAdapter;
|
||||
import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
|
||||
import org.apache.doris.qe.AutoCloseConnectContext;
|
||||
import org.apache.doris.qe.ConnectContext;
|
||||
import org.apache.doris.qe.OriginStatement;
|
||||
import org.apache.doris.qe.QueryState.MysqlStateType;
|
||||
import org.apache.doris.qe.StmtExecutor;
|
||||
import org.apache.doris.scheduler.exception.JobException;
|
||||
@ -42,7 +41,6 @@ import org.apache.doris.thrift.TUniqueId;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -136,13 +134,7 @@ public class ExportTaskExecutor implements TransientTaskExecutor {
|
||||
}
|
||||
|
||||
try (AutoCloseConnectContext r = buildConnectContext()) {
|
||||
StatementBase statementBase = selectStmtLists.get(idx);
|
||||
OriginStatement originStatement = new OriginStatement(
|
||||
StringUtils.isEmpty(statementBase.getOrigStmt().originStmt)
|
||||
? exportJob.getOrigStmt().originStmt : statementBase.getOrigStmt().originStmt, idx);
|
||||
statementBase.setOrigStmt(originStatement);
|
||||
stmtExecutor = new StmtExecutor(r.connectContext, statementBase);
|
||||
|
||||
stmtExecutor = new StmtExecutor(r.connectContext, selectStmtLists.get(idx));
|
||||
stmtExecutor.execute();
|
||||
if (r.connectContext.getState().getStateType() == MysqlStateType.ERR) {
|
||||
exportJob.updateExportJobState(ExportJobState.CANCELLED, taskId, null,
|
||||
@ -179,6 +171,9 @@ public class ExportTaskExecutor implements TransientTaskExecutor {
|
||||
ConnectContext connectContext = new ConnectContext();
|
||||
exportJob.getSessionVariables().setQueryTimeoutS(exportJob.getTimeoutSecond());
|
||||
connectContext.setSessionVariable(exportJob.getSessionVariables());
|
||||
// The rollback to the old optimizer is prohibited
|
||||
// Since originStmt is empty, reverting to the old optimizer when the new optimizer is enabled is meaningless.
|
||||
connectContext.getSessionVariable().enableFallbackToOriginalPlanner = false;
|
||||
connectContext.setEnv(Env.getCurrentEnv());
|
||||
connectContext.setDatabase(exportJob.getTableName().getDb());
|
||||
connectContext.setQualifiedUser(exportJob.getQualifiedUser());
|
||||
|
||||
@ -249,9 +249,6 @@ public class ExportCommand extends Command implements ForwardWithSync {
|
||||
exportJob.setTableName(tblName);
|
||||
exportJob.setExportTable(table);
|
||||
exportJob.setTableId(table.getId());
|
||||
if (ctx.getExecutor() != null) {
|
||||
exportJob.setOrigStmt(ctx.getExecutor().getOriginStmt());
|
||||
}
|
||||
// set partitions
|
||||
exportJob.setPartitionNames(this.partitionsNames);
|
||||
// set where expression
|
||||
|
||||
@ -216,7 +216,7 @@ public class ConnectContext {
|
||||
|
||||
private StatsErrorEstimator statsErrorEstimator;
|
||||
|
||||
private Map<String, String> resultAttachedInfo;
|
||||
private Map<String, String> resultAttachedInfo = Maps.newHashMap();
|
||||
|
||||
private String workloadGroupName = "";
|
||||
private Map<Long, Backend> insertGroupCommitTableToBeMap = new HashMap<>();
|
||||
|
||||
Reference in New Issue
Block a user