Skip to content

Commit

Permalink
Fix comment
Browse files Browse the repository at this point in the history
Signed-off-by: wyb <[email protected]>
  • Loading branch information
wyb committed Sep 20, 2024
1 parent b3e7cb6 commit 17a48db
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
import com.starrocks.sql.analyzer.Authorizer;
import com.starrocks.sql.analyzer.SemanticException;
import com.starrocks.sql.ast.CleanTemporaryTableStmt;
import com.starrocks.sql.ast.DmlStmt;
import com.starrocks.sql.ast.SetListItem;
import com.starrocks.sql.ast.SetStmt;
import com.starrocks.sql.ast.SetType;
Expand Down Expand Up @@ -922,7 +921,7 @@ private String getExecType() {
}

private boolean isExecLoadType() {
return executor != null && executor.getParsedStmt() instanceof DmlStmt;
return executor != null && executor.isExecLoadType();
}

public void checkTimeout(long now) {
Expand Down
45 changes: 20 additions & 25 deletions fe/fe-core/src/main/java/com/starrocks/qe/StmtExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,26 @@ public StatementBase getParsedStmt() {
return parsedStmt;
}

public int getExecTimeout() {
return parsedStmt.getTimeout();
}

public String getExecType() {
if (parsedStmt instanceof InsertStmt || parsedStmt instanceof CreateTableAsSelectStmt) {
return "Insert";
} else if (parsedStmt instanceof UpdateStmt) {
return "Update";
} else if (parsedStmt instanceof DeleteStmt) {
return "Delete";
} else {
return "Query";
}
}

public boolean isExecLoadType() {
return parsedStmt instanceof DmlStmt || parsedStmt instanceof CreateTableAsSelectStmt;
}

// Execute one statement.
// Exception:
// IOException: talk with client failed.
Expand Down Expand Up @@ -2693,29 +2713,4 @@ public void addFinishedQueryDetail() {

QueryDetailQueue.addQueryDetail(queryDetail);
}

public int getExecTimeout() {
if (parsedStmt instanceof DmlStmt) {
int timeout = ((DmlStmt) parsedStmt).getTimeout();
return timeout != -1 ? timeout : context.getSessionVariable().getInsertTimeoutS();
}
if (parsedStmt instanceof CreateTableAsSelectStmt) {
InsertStmt insertStmt = ((CreateTableAsSelectStmt) parsedStmt).getInsertStmt();
int timeout = insertStmt.getTimeout();
return timeout != -1 ? timeout : context.getSessionVariable().getInsertTimeoutS();
}
return context.getSessionVariable().getQueryTimeoutS();
}

public String getExecType() {
if (parsedStmt instanceof InsertStmt || parsedStmt instanceof CreateTableAsSelectStmt) {
return "Insert";
} else if (parsedStmt instanceof UpdateStmt) {
return "Update";
} else if (parsedStmt instanceof DeleteStmt) {
return "Delete";
} else {
return "Query";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,9 @@ public String toSql() {
public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
return visitor.visitCreateTableAsSelectStatement(this, context);
}

@Override
public int getTimeout() {
return insertStmt.getTimeout();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.starrocks.analysis.ParseNode;
import com.starrocks.analysis.RedirectStatus;
import com.starrocks.common.profile.Tracers;
import com.starrocks.qe.ConnectContext;
import com.starrocks.qe.OriginStatement;
import com.starrocks.sql.parser.NodePosition;
import org.apache.commons.collections4.CollectionUtils;
Expand Down Expand Up @@ -151,4 +152,8 @@ public void setAllQueryScopeHints(List<HintNode> hintNodes) {
public boolean isExistQueryScopeHint() {
return CollectionUtils.isNotEmpty(allQueryScopeHints);
}

public int getTimeout() {
return ConnectContext.get().getSessionVariable().getQueryTimeoutS();
}
}

0 comments on commit 17a48db

Please sign in to comment.