[enhancement](stmt-exec) make CTAS use insert timeout fix forward timeout (#25731)

This commit is contained in:
Siyang Tang
2023-10-23 14:57:02 +08:00
committed by GitHub
parent ed85c441b7
commit 75000a5f6e
3 changed files with 12 additions and 5 deletions

View File

@ -150,6 +150,10 @@ public class CreateTableCommand extends Command implements ForwardWithSync {
}
}
public boolean isCtasCommand() {
return ctasQuery.isPresent();
}
@Override
public <R, C> R accept(PlanVisitor<R, C> visitor, C context) {
return visitor.visitCreateTableCommand(this, context);

View File

@ -748,7 +748,7 @@ public class ConnectContext {
} else {
String timeoutTag = "query";
// insert stmt particularly
if (executor != null && executor.isInsertStmt()) {
if (executor != null && executor.isSyncLoadKindStmt()) {
timeoutTag = "insert";
}
// to ms
@ -802,7 +802,7 @@ public class ConnectContext {
* @return exact execution timeout
*/
public int getExecTimeout() {
if (executor != null && executor.isInsertStmt()) {
if (executor != null && executor.isSyncLoadKindStmt()) {
// particular for insert stmt, we can expand other type of timeout in the same way
return Math.max(sessionVariable.getInsertTimeoutS(), sessionVariable.getQueryTimeoutS());
} else if (executor != null && executor.isAnalyzeStmt()) {

View File

@ -122,6 +122,7 @@ import org.apache.doris.nereids.minidump.MinidumpUtils;
import org.apache.doris.nereids.parser.NereidsParser;
import org.apache.doris.nereids.stats.StatsErrorEstimator;
import org.apache.doris.nereids.trees.plans.commands.Command;
import org.apache.doris.nereids.trees.plans.commands.CreateTableCommand;
import org.apache.doris.nereids.trees.plans.commands.Forward;
import org.apache.doris.nereids.trees.plans.commands.InsertIntoTableCommand;
import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
@ -395,15 +396,17 @@ public class StmtExecutor {
return masterOpExecutor.getProxyStatus();
}
public boolean isInsertStmt() {
public boolean isSyncLoadKindStmt() {
if (parsedStmt == null) {
return false;
}
if (parsedStmt instanceof LogicalPlanAdapter) {
LogicalPlan logicalPlan = ((LogicalPlanAdapter) parsedStmt).getLogicalPlan();
return logicalPlan instanceof InsertIntoTableCommand;
return logicalPlan instanceof InsertIntoTableCommand
|| (logicalPlan instanceof CreateTableCommand
&& ((CreateTableCommand) logicalPlan).isCtasCommand());
}
return parsedStmt instanceof InsertStmt;
return parsedStmt instanceof InsertStmt || parsedStmt instanceof CreateTableAsSelectStmt;
}
public boolean isAnalyzeStmt() {