This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 1d964d80f7c branch-4.0: [fix](variable) support set ON and ALL to
variable #58287 (#58329)
1d964d80f7c is described below
commit 1d964d80f7cda26c10f0d1a8b03987530b902443
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Nov 25 18:08:22 2025 +0800
branch-4.0: [fix](variable) support set ON and ALL to variable #58287
(#58329)
Cherry-picked from #58287
Co-authored-by: morrySnow <[email protected]>
---
.../src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 | 7 ++++---
.../org/apache/doris/nereids/parser/LogicalPlanBuilder.java | 10 ++++++++++
.../org/apache/doris/nereids/parser/NereidsParserTest.java | 6 ++++++
3 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
index 9ca29f37594..5985917fff8 100644
--- a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
+++ b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
@@ -911,7 +911,7 @@ supportedSetStatement
;
optionWithType
- : statementScope identifier EQ (expression | DEFAULT)
#setVariableWithType
+ : statementScope identifier EQ (expression | DEFAULT | ON | ALL)
#setVariableWithType
;
optionWithoutType
@@ -927,8 +927,9 @@ optionWithoutType
;
variable
- : (DOUBLEATSIGN (statementScope DOT)?)? identifier EQ (expression |
DEFAULT) #setSystemVariable
- | ATSIGN identifier EQ expression #setUserVariable
+ : (DOUBLEATSIGN (statementScope DOT)?)? identifier EQ
+ (expression | DEFAULT | ON | ALL)
#setSystemVariable
+ | ATSIGN identifier EQ expression
#setUserVariable
;
transactionAccessMode
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
index 98caca0ce37..905a6008c6c 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
@@ -5254,6 +5254,11 @@ public class LogicalPlanBuilder extends
DorisParserBaseVisitor<Object> {
SetType statementScope = visitStatementScope(ctx.statementScope());
String name = stripQuotes(ctx.identifier().getText());
Expression expression = ctx.expression() != null ?
typedVisit(ctx.expression()) : null;
+ if (ctx.ON() != null) {
+ expression = new StringLiteral("on");
+ } else if (ctx.ALL() != null) {
+ expression = new StringLiteral("all");
+ }
return new SetSessionVarOp(statementScope, name, expression);
}
@@ -5262,6 +5267,11 @@ public class LogicalPlanBuilder extends
DorisParserBaseVisitor<Object> {
SetType statementScope = visitStatementScope(ctx.statementScope());
String name = stripQuotes(ctx.identifier().getText());
Expression expression = ctx.expression() != null ?
typedVisit(ctx.expression()) : null;
+ if (ctx.ON() != null) {
+ expression = new StringLiteral("on");
+ } else if (ctx.ALL() != null) {
+ expression = new StringLiteral("all");
+ }
return new SetSessionVarOp(statementScope, name, expression);
}
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/nereids/parser/NereidsParserTest.java
b/fe/fe-core/src/test/java/org/apache/doris/nereids/parser/NereidsParserTest.java
index 7ff1273fcca..5a47ff15c08 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/nereids/parser/NereidsParserTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/nereids/parser/NereidsParserTest.java
@@ -527,6 +527,12 @@ public class NereidsParserTest extends ParserTestBase {
sql = "set session a = default";
nereidsParser.parseSingle(sql);
+ sql = "set a = on";
+ nereidsParser.parseSingle(sql);
+
+ sql = "set a = all";
+ nereidsParser.parseSingle(sql);
+
sql = "set @@a = 10";
nereidsParser.parseSingle(sql);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]