diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetVar.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/SetVar.java index e80860bf58..38b3a472e7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetVar.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/SetVar.java @@ -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)) { diff --git a/regression-test/suites/insert_p0/insert_group_commit_into.groovy b/regression-test/suites/insert_p0/insert_group_commit_into.groovy index 4c616c3a33..4d43c38f14 100644 --- a/regression-test/suites/insert_p0/insert_group_commit_into.groovy +++ b/regression-test/suites/insert_p0/insert_group_commit_into.groovy @@ -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; """