branch-2.1: [fix](group commit) check group commit session value (#48253)

pick https://github.com/apache/doris/pull/48112
This commit is contained in:
meiyi
2025-02-24 21:55:53 +08:00
committed by GitHub
parent 47695319be
commit ccd1b073f8
2 changed files with 13 additions and 0 deletions

View File

@ -25,6 +25,7 @@ import org.apache.doris.common.UserException;
import org.apache.doris.common.util.ParseUtil;
import org.apache.doris.common.util.TimeUtils;
import org.apache.doris.mysql.privilege.PrivPredicate;
import org.apache.doris.planner.GroupCommitBlockSink;
import org.apache.doris.qe.ConnectContext;
import org.apache.doris.qe.GlobalVariable;
import org.apache.doris.qe.SessionVariable;
@ -178,6 +179,13 @@ public class SetVar {
this.value = new StringLiteral(TimeUtils.checkTimeZoneValidAndStandardize(getResult().getStringValue()));
this.result = (LiteralExpr) this.value;
}
if (getVariable().equalsIgnoreCase(SessionVariable.GROUP_COMMIT)) {
String value = getResult().getStringValue();
if (GroupCommitBlockSink.parseGroupCommit(value) == null) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_WRONG_VALUE_FOR_VAR,
SessionVariable.GROUP_COMMIT, value);
}
}
if (getVariable().equalsIgnoreCase(SessionVariable.EXEC_MEM_LIMIT)
|| getVariable().equalsIgnoreCase(SessionVariable.SCAN_QUEUE_MEM_LIMIT)) {

View File

@ -121,6 +121,11 @@ suite("insert_group_commit_into") {
"""
connect(context.config.jdbcUser, context.config.jdbcPassword, context.config.jdbcUrl) {
test {
sql """ set group_commit = abc; """
exception """ Variable 'group_commit' can't be set to the value of """
}
sql """ set group_commit = async_mode; """
if (item == "nereids") {
sql """ set enable_nereids_dml = true; """