This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new c8b130ad82a [fix](variable) support set ON and ALL to variable (#58287)
c8b130ad82a is described below
commit c8b130ad82a433b1b33b843e90fe6fc8572a0a0e
Author: morrySnow <[email protected]>
AuthorDate: Tue Nov 25 10:31:40 2025 +0800
[fix](variable) support set ON and ALL to variable (#58287)
---
.../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 116264b1f81..999be029e8b 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 1766288008f..a30201b74bc 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
@@ -5251,6 +5251,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);
}
@@ -5259,6 +5264,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 0d900ff31df..6b134440ae6 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]