You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "starocean999 (via GitHub)" <gi...@apache.org> on 2024/10/15 13:25:54 UTC

[PR] [feature](nereids)support set command [doris]

starocean999 opened a new pull request, #41913:
URL: https://github.com/apache/doris/pull/41913

   ## Proposed changes
   
   Issue Number: close #xxx
   
   <!--Describe your changes.-->
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2422079052

   
   <details>
   <summary>ClickBench: <b>Total hot run time: 32.97 s</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
   ClickBench test result on commit 45e4fc2e3327fb9fd9d3640f975d672d13109104, data reload: false
   
   query1	0.04	0.04	0.03
   query2	0.06	0.03	0.04
   query3	0.23	0.06	0.07
   query4	1.65	0.10	0.09
   query5	0.52	0.50	0.50
   query6	1.13	0.74	0.73
   query7	0.02	0.02	0.01
   query8	0.04	0.03	0.04
   query9	0.58	0.49	0.51
   query10	0.55	0.55	0.53
   query11	0.14	0.10	0.10
   query12	0.13	0.11	0.11
   query13	0.61	0.59	0.60
   query14	2.85	2.83	2.79
   query15	0.88	0.83	0.85
   query16	0.38	0.41	0.39
   query17	0.98	1.02	1.03
   query18	0.20	0.19	0.19
   query19	1.88	1.76	1.98
   query20	0.01	0.01	0.01
   query21	15.37	0.57	0.59
   query22	2.80	2.22	1.98
   query23	17.08	0.79	0.83
   query24	2.93	1.54	1.12
   query25	0.25	0.20	0.10
   query26	0.46	0.13	0.13
   query27	0.05	0.04	0.04
   query28	10.24	1.11	1.08
   query29	12.52	3.22	3.22
   query30	0.25	0.06	0.06
   query31	2.88	0.39	0.37
   query32	3.26	0.46	0.46
   query33	3.01	3.02	3.04
   query34	17.05	4.50	4.49
   query35	4.46	4.48	4.49
   query36	0.70	0.48	0.48
   query37	0.08	0.06	0.06
   query38	0.05	0.03	0.04
   query39	0.03	0.02	0.02
   query40	0.16	0.13	0.11
   query41	0.07	0.02	0.02
   query42	0.03	0.02	0.02
   query43	0.03	0.03	0.03
   Total cold run time: 106.64 s
   Total hot run time: 32.97 s
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2417143272

   
   <details>
   <summary>TPC-H: <b>Total hot run time: 41133 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
   Tpch sf100 test result on commit 67f39710dcd6cb1ef3a4054d604a7278a7cdbde0, data reload: false
   
   ------ Round 1 ----------------------------------
   q1	17593	7380	7279	7279
   q2	2014	285	293	285
   q3	12068	1063	1163	1063
   q4	10569	779	828	779
   q5	7771	3094	3041	3041
   q6	244	155	154	154
   q7	1023	619	618	618
   q8	9360	1910	1978	1910
   q9	6605	6453	6404	6404
   q10	7041	2424	2421	2421
   q11	449	244	252	244
   q12	409	224	228	224
   q13	17791	3013	3029	3013
   q14	245	207	219	207
   q15	576	525	518	518
   q16	653	600	581	581
   q17	960	523	506	506
   q18	7335	6648	6765	6648
   q19	1355	908	1052	908
   q20	474	186	190	186
   q21	3958	3138	3225	3138
   q22	1128	1006	1009	1006
   Total cold run time: 109621 ms
   Total hot run time: 41133 ms
   
   ----- Round 2, with runtime_filter_mode=off -----
   q1	7325	7296	7260	7260
   q2	340	235	237	235
   q3	2973	2934	2957	2934
   q4	2037	1856	1754	1754
   q5	5769	5756	5805	5756
   q6	231	149	149	149
   q7	2278	1903	1848	1848
   q8	3362	3582	3466	3466
   q9	8938	8935	8868	8868
   q10	3614	3549	3562	3549
   q11	593	491	483	483
   q12	830	601	625	601
   q13	9993	3238	3185	3185
   q14	311	271	283	271
   q15	580	527	516	516
   q16	711	641	642	641
   q17	1841	1627	1593	1593
   q18	8224	7878	7579	7579
   q19	1738	1393	1453	1393
   q20	2125	1888	1870	1870
   q21	5665	5354	5497	5354
   q22	1136	1101	1069	1069
   Total cold run time: 70614 ms
   Total hot run time: 60374 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "starocean999 (via GitHub)" <gi...@apache.org>.
starocean999 commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2417028625

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2416533449

   
   <details>
   <summary>TPC-H: <b>Total hot run time: 41163 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
   Tpch sf100 test result on commit 879c0e2bab46b0dd2ae3dbd9ec12409304770be0, data reload: false
   
   ------ Round 1 ----------------------------------
   q1	17554	7402	7269	7269
   q2	2034	306	299	299
   q3	11934	1058	1130	1058
   q4	10566	891	844	844
   q5	7780	3121	3030	3030
   q6	238	151	148	148
   q7	1020	622	606	606
   q8	9358	1964	1909	1909
   q9	6561	6460	6394	6394
   q10	7040	2453	2411	2411
   q11	438	245	242	242
   q12	423	220	212	212
   q13	17763	2985	3002	2985
   q14	248	221	207	207
   q15	568	522	518	518
   q16	624	589	578	578
   q17	981	547	575	547
   q18	7188	6770	6647	6647
   q19	1353	1032	1028	1028
   q20	479	180	182	180
   q21	3944	3042	3115	3042
   q22	1111	1009	1025	1009
   Total cold run time: 109205 ms
   Total hot run time: 41163 ms
   
   ----- Round 2, with runtime_filter_mode=off -----
   q1	7257	7242	7241	7241
   q2	324	235	229	229
   q3	2970	2963	2903	2903
   q4	2159	1875	1799	1799
   q5	5763	5750	5793	5750
   q6	237	145	145	145
   q7	2258	1875	1752	1752
   q8	3391	3534	3439	3439
   q9	8919	8894	8952	8894
   q10	3599	3567	3511	3511
   q11	581	489	492	489
   q12	820	657	627	627
   q13	9426	3172	3189	3172
   q14	317	279	282	279
   q15	562	521	524	521
   q16	708	669	626	626
   q17	1839	1618	1593	1593
   q18	8254	7916	7694	7694
   q19	1727	1471	1381	1381
   q20	2153	1863	1886	1863
   q21	5497	5331	5533	5331
   q22	1194	1077	1048	1048
   Total cold run time: 69955 ms
   Total hot run time: 60287 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow commented on code in PR #41913:
URL: https://github.com/apache/doris/pull/41913#discussion_r1816092697


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -3829,4 +3855,113 @@ public LogicalPlan visitShowConfig(ShowConfigContext ctx) {
         }
         return command;
     }
+
+    @Override
+    public SetOptionsCommand visitSetOptions(SetOptionsContext ctx) {
+        List<SetVarOp> setVarOpList = new ArrayList<>(1);
+        for (Object child : ctx.children) {
+            if (child instanceof RuleNode) {
+                setVarOpList.add(typedVisit((RuleNode) child));
+            }
+        }
+        return new SetOptionsCommand(setVarOpList);
+    }
+
+    @Override
+    public SetVarOp visitSetSystemVariable(SetSystemVariableContext ctx) {
+        SetType type = SetType.DEFAULT;
+        if (ctx.GLOBAL() != null) {
+            type = SetType.GLOBAL;
+        } else if (ctx.LOCAL() != null || ctx.SESSION() != null) {
+            type = SetType.SESSION;
+        }
+        String name = stripQuotes(ctx.identifier().getText());
+        Expression expression = ctx.expression() != null ? typedVisit(ctx.expression()) : NullLiteral.INSTANCE;

Review Comment:
   use NullLiteral to present default? i don't think this is a good idea, because we may need to assign NullLiteral to some variable in future



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -3829,4 +3855,113 @@ public LogicalPlan visitShowConfig(ShowConfigContext ctx) {
         }
         return command;
     }
+
+    @Override
+    public SetOptionsCommand visitSetOptions(SetOptionsContext ctx) {
+        List<SetVarOp> setVarOpList = new ArrayList<>(1);
+        for (Object child : ctx.children) {
+            if (child instanceof RuleNode) {
+                setVarOpList.add(typedVisit((RuleNode) child));
+            }
+        }
+        return new SetOptionsCommand(setVarOpList);
+    }
+
+    @Override
+    public SetVarOp visitSetSystemVariable(SetSystemVariableContext ctx) {
+        SetType type = SetType.DEFAULT;
+        if (ctx.GLOBAL() != null) {
+            type = SetType.GLOBAL;
+        } else if (ctx.LOCAL() != null || ctx.SESSION() != null) {
+            type = SetType.SESSION;
+        }
+        String name = stripQuotes(ctx.identifier().getText());
+        Expression expression = ctx.expression() != null ? typedVisit(ctx.expression()) : NullLiteral.INSTANCE;
+        return new SetSessionVarOp(type, name, expression);
+    }
+
+    @Override
+    public SetVarOp visitSetVariableWithType(SetVariableWithTypeContext ctx) {
+        SetType type = SetType.DEFAULT;
+        if (ctx.GLOBAL() != null) {
+            type = SetType.GLOBAL;
+        } else if (ctx.LOCAL() != null || ctx.SESSION() != null) {
+            type = SetType.SESSION;
+        }
+        String name = stripQuotes(ctx.identifier().getText());
+        Expression expression = ctx.expression() != null ? typedVisit(ctx.expression()) : NullLiteral.INSTANCE;

Review Comment:
   ditto



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -3829,4 +3855,113 @@ public LogicalPlan visitShowConfig(ShowConfigContext ctx) {
         }
         return command;
     }
+
+    @Override
+    public SetOptionsCommand visitSetOptions(SetOptionsContext ctx) {
+        List<SetVarOp> setVarOpList = new ArrayList<>(1);
+        for (Object child : ctx.children) {
+            if (child instanceof RuleNode) {
+                setVarOpList.add(typedVisit((RuleNode) child));
+            }
+        }
+        return new SetOptionsCommand(setVarOpList);
+    }
+
+    @Override
+    public SetVarOp visitSetSystemVariable(SetSystemVariableContext ctx) {
+        SetType type = SetType.DEFAULT;
+        if (ctx.GLOBAL() != null) {
+            type = SetType.GLOBAL;
+        } else if (ctx.LOCAL() != null || ctx.SESSION() != null) {
+            type = SetType.SESSION;
+        }
+        String name = stripQuotes(ctx.identifier().getText());
+        Expression expression = ctx.expression() != null ? typedVisit(ctx.expression()) : NullLiteral.INSTANCE;
+        return new SetSessionVarOp(type, name, expression);
+    }
+
+    @Override
+    public SetVarOp visitSetVariableWithType(SetVariableWithTypeContext ctx) {
+        SetType type = SetType.DEFAULT;
+        if (ctx.GLOBAL() != null) {
+            type = SetType.GLOBAL;
+        } else if (ctx.LOCAL() != null || ctx.SESSION() != null) {
+            type = SetType.SESSION;
+        }
+        String name = stripQuotes(ctx.identifier().getText());
+        Expression expression = ctx.expression() != null ? typedVisit(ctx.expression()) : NullLiteral.INSTANCE;
+        return new SetSessionVarOp(type, name, expression);
+    }
+
+    @Override
+    public SetVarOp visitSetPassword(SetPasswordContext ctx) {
+        String user;
+        String host;
+        boolean isDomain;
+        String passwordText;
+        boolean isPlain;
+        UserIdentity userIdentity = null;
+        if (ctx.userIdentify() != null) {
+            user = stripQuotes(ctx.userIdentify().user.getText());
+            host = ctx.userIdentify().host != null ? stripQuotes(ctx.userIdentify().host.getText()) : "%";
+            isDomain = ctx.userIdentify().LEFT_PAREN() != null;
+            userIdentity = new UserIdentity(user, host, isDomain);
+        }
+        passwordText = stripQuotes(ctx.STRING_LITERAL().getText());
+        isPlain = ctx.LEFT_PAREN() != null;
+        return new SetPassVarOp(userIdentity, new PassVar(passwordText, isPlain));
+    }
+
+    @Override
+    public SetVarOp visitSetNames(SetNamesContext ctx) {
+        return new SetNamesVarOp();
+    }
+
+    @Override
+    public SetVarOp visitSetCharset(SetCharsetContext ctx) {
+        String charset = ctx.charsetName != null ? stripQuotes(ctx.charsetName.getText()) : null;
+        return new SetCharsetAndCollateVarOp(charset);
+    }
+
+    @Override
+    public SetVarOp visitSetCollate(SetCollateContext ctx) {
+        String charset = ctx.charsetName != null ? stripQuotes(ctx.charsetName.getText()) : null;
+        String collate = ctx.collateName != null ? stripQuotes(ctx.collateName.getText()) : null;
+        return new SetCharsetAndCollateVarOp(charset, collate);
+    }
+
+    @Override
+    public SetVarOp visitSetLdapAdminPassword(SetLdapAdminPasswordContext ctx) {
+        String passwordText = stripQuotes(ctx.STRING_LITERAL().getText());
+        boolean isPlain = ctx.LEFT_PAREN() != null;

Review Comment:
   ```suggestion
           boolean isPlain = ctx.PASSWORD() != null;
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -3829,4 +3855,113 @@ public LogicalPlan visitShowConfig(ShowConfigContext ctx) {
         }
         return command;
     }
+
+    @Override
+    public SetOptionsCommand visitSetOptions(SetOptionsContext ctx) {
+        List<SetVarOp> setVarOpList = new ArrayList<>(1);
+        for (Object child : ctx.children) {
+            if (child instanceof RuleNode) {
+                setVarOpList.add(typedVisit((RuleNode) child));
+            }
+        }
+        return new SetOptionsCommand(setVarOpList);
+    }
+
+    @Override
+    public SetVarOp visitSetSystemVariable(SetSystemVariableContext ctx) {
+        SetType type = SetType.DEFAULT;
+        if (ctx.GLOBAL() != null) {
+            type = SetType.GLOBAL;
+        } else if (ctx.LOCAL() != null || ctx.SESSION() != null) {
+            type = SetType.SESSION;
+        }
+        String name = stripQuotes(ctx.identifier().getText());
+        Expression expression = ctx.expression() != null ? typedVisit(ctx.expression()) : NullLiteral.INSTANCE;
+        return new SetSessionVarOp(type, name, expression);
+    }
+
+    @Override
+    public SetVarOp visitSetVariableWithType(SetVariableWithTypeContext ctx) {
+        SetType type = SetType.DEFAULT;
+        if (ctx.GLOBAL() != null) {
+            type = SetType.GLOBAL;
+        } else if (ctx.LOCAL() != null || ctx.SESSION() != null) {
+            type = SetType.SESSION;
+        }
+        String name = stripQuotes(ctx.identifier().getText());
+        Expression expression = ctx.expression() != null ? typedVisit(ctx.expression()) : NullLiteral.INSTANCE;
+        return new SetSessionVarOp(type, name, expression);
+    }
+
+    @Override
+    public SetVarOp visitSetPassword(SetPasswordContext ctx) {
+        String user;
+        String host;
+        boolean isDomain;
+        String passwordText;
+        boolean isPlain;
+        UserIdentity userIdentity = null;
+        if (ctx.userIdentify() != null) {
+            user = stripQuotes(ctx.userIdentify().user.getText());
+            host = ctx.userIdentify().host != null ? stripQuotes(ctx.userIdentify().host.getText()) : "%";
+            isDomain = ctx.userIdentify().LEFT_PAREN() != null;

Review Comment:
   should use `ATSIGN` ?



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -3829,4 +3855,113 @@ public LogicalPlan visitShowConfig(ShowConfigContext ctx) {
         }
         return command;
     }
+
+    @Override
+    public SetOptionsCommand visitSetOptions(SetOptionsContext ctx) {
+        List<SetVarOp> setVarOpList = new ArrayList<>(1);
+        for (Object child : ctx.children) {
+            if (child instanceof RuleNode) {
+                setVarOpList.add(typedVisit((RuleNode) child));
+            }
+        }
+        return new SetOptionsCommand(setVarOpList);
+    }
+
+    @Override
+    public SetVarOp visitSetSystemVariable(SetSystemVariableContext ctx) {
+        SetType type = SetType.DEFAULT;
+        if (ctx.GLOBAL() != null) {
+            type = SetType.GLOBAL;
+        } else if (ctx.LOCAL() != null || ctx.SESSION() != null) {
+            type = SetType.SESSION;
+        }
+        String name = stripQuotes(ctx.identifier().getText());
+        Expression expression = ctx.expression() != null ? typedVisit(ctx.expression()) : NullLiteral.INSTANCE;
+        return new SetSessionVarOp(type, name, expression);
+    }
+
+    @Override
+    public SetVarOp visitSetVariableWithType(SetVariableWithTypeContext ctx) {
+        SetType type = SetType.DEFAULT;
+        if (ctx.GLOBAL() != null) {
+            type = SetType.GLOBAL;
+        } else if (ctx.LOCAL() != null || ctx.SESSION() != null) {
+            type = SetType.SESSION;
+        }
+        String name = stripQuotes(ctx.identifier().getText());
+        Expression expression = ctx.expression() != null ? typedVisit(ctx.expression()) : NullLiteral.INSTANCE;
+        return new SetSessionVarOp(type, name, expression);
+    }
+
+    @Override
+    public SetVarOp visitSetPassword(SetPasswordContext ctx) {
+        String user;
+        String host;
+        boolean isDomain;
+        String passwordText;
+        boolean isPlain;
+        UserIdentity userIdentity = null;
+        if (ctx.userIdentify() != null) {
+            user = stripQuotes(ctx.userIdentify().user.getText());
+            host = ctx.userIdentify().host != null ? stripQuotes(ctx.userIdentify().host.getText()) : "%";
+            isDomain = ctx.userIdentify().LEFT_PAREN() != null;
+            userIdentity = new UserIdentity(user, host, isDomain);
+        }
+        passwordText = stripQuotes(ctx.STRING_LITERAL().getText());
+        isPlain = ctx.LEFT_PAREN() != null;

Review Comment:
   we assign a name on second PASSWORD in antlr file, and use it to judgement `isPlain`



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/Command.java:
##########
@@ -116,4 +116,14 @@ public String treeString() {
     public Plan withGroupExpression(Optional<GroupExpression> groupExpression) {
         throw new RuntimeException("Command do not implement withGroupExpression");
     }
+
+    public String toSql() {
+        return "";
+    }
+
+    public boolean needAuditEncryption() {
+        return false;
+    }
+
+    public void afterForwardToMaster(ConnectContext ctx) throws Exception {}

Review Comment:
   maybe this interface should in `Forward` trait



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/Command.java:
##########
@@ -116,4 +116,14 @@ public String treeString() {
     public Plan withGroupExpression(Optional<GroupExpression> groupExpression) {
         throw new RuntimeException("Command do not implement withGroupExpression");
     }
+
+    public String toSql() {
+        return "";
+    }
+
+    public boolean needAuditEncryption() {
+        return false;
+    }

Review Comment:
   command should not have these interface



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/SetPassVarOp.java:
##########
@@ -0,0 +1,103 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.trees.plans.commands.info;
+
+import org.apache.doris.analysis.PassVar;
+import org.apache.doris.analysis.SetType;
+import org.apache.doris.analysis.UserIdentity;
+import org.apache.doris.catalog.Env;
+import org.apache.doris.cluster.ClusterNamespace;
+import org.apache.doris.common.AnalysisException;
+import org.apache.doris.common.ErrorCode;
+import org.apache.doris.common.ErrorReport;
+import org.apache.doris.common.UserException;
+import org.apache.doris.mysql.privilege.Auth;
+import org.apache.doris.mysql.privilege.PrivPredicate;
+import org.apache.doris.qe.ConnectContext;
+
+/**
+ * SetPassVarOp
+ */
+public class SetPassVarOp extends SetVarOp {
+    private UserIdentity userIdent;
+    private PassVar passVar;
+
+    // The password in parameter is a hashed password.
+    public SetPassVarOp(UserIdentity userIdent, PassVar passVar) {
+        super(SetType.DEFAULT);
+        this.userIdent = userIdent;
+        this.passVar = passVar;
+    }
+
+    @Override
+    public void validate(ConnectContext ctx) throws UserException {
+        boolean isSelf = false;
+        if (userIdent == null) {
+            // set userIdent as what current_user() returns
+            userIdent = ctx.getCurrentUserIdentity();
+            isSelf = true;
+        } else {
+            userIdent.analyze();
+            if (userIdent.equals(ctx.getCurrentUserIdentity())) {
+                isSelf = true;
+            }
+        }
+
+        // Check password
+        if (passVar != null) {
+            passVar.analyze();
+        }
+
+        // check privs.
+        // 1. this is user itself
+        if (isSelf) {
+            return;
+        }
+
+        // 2. No user can set password for root expect for root user itself
+        if (userIdent.getQualifiedUser().equals(Auth.ROOT_USER)
+                && !ClusterNamespace.getNameFromFullName(ctx.getQualifiedUser()).equals(Auth.ROOT_USER)) {
+            throw new AnalysisException("Can not set password for root user, except root itself");

Review Comment:
   use isSelf to check it better?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2445679026

   
   <details>
   <summary>TPC-H: <b>Total hot run time: 41254 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
   Tpch sf100 test result on commit 028fd7c377d0e3bd155f16bf23a861da82ba489e, data reload: false
   
   ------ Round 1 ----------------------------------
   q1	17588	7368	7252	7252
   q2	2057	165	177	165
   q3	10561	1062	1209	1062
   q4	10597	842	843	842
   q5	7736	3055	3026	3026
   q6	231	147	141	141
   q7	1013	623	617	617
   q8	9353	1936	1969	1936
   q9	6611	6417	6450	6417
   q10	7024	2422	2457	2422
   q11	453	236	237	236
   q12	411	207	207	207
   q13	17767	3032	3026	3026
   q14	227	208	215	208
   q15	576	511	517	511
   q16	689	572	570	570
   q17	974	595	553	553
   q18	7262	6875	6826	6826
   q19	1343	972	976	972
   q20	474	186	191	186
   q21	3980	3186	3084	3084
   q22	1104	995	1016	995
   Total cold run time: 108031 ms
   Total hot run time: 41254 ms
   
   ----- Round 2, with runtime_filter_mode=off -----
   q1	7294	7211	7212	7211
   q2	329	228	232	228
   q3	2881	2933	2955	2933
   q4	2034	1852	1807	1807
   q5	5765	5790	5768	5768
   q6	224	141	140	140
   q7	2268	1878	1814	1814
   q8	3370	3504	3518	3504
   q9	8848	8893	8900	8893
   q10	3619	3593	3560	3560
   q11	579	487	497	487
   q12	840	668	658	658
   q13	10344	3215	3205	3205
   q14	305	279	272	272
   q15	570	509	513	509
   q16	706	632	641	632
   q17	1842	1649	1625	1625
   q18	8343	7902	7594	7594
   q19	1709	1634	1568	1568
   q20	2109	1885	1842	1842
   q21	5649	5361	5416	5361
   q22	1157	1046	1038	1038
   Total cold run time: 70785 ms
   Total hot run time: 60649 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2440447664

   
   <details>
   <summary>ClickBench: <b>Total hot run time: 32.8 s</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
   ClickBench test result on commit df9aad3b76721d6c55947a78c81ff10219534d30, data reload: false
   
   query1	0.03	0.03	0.03
   query2	0.06	0.03	0.03
   query3	0.23	0.06	0.06
   query4	1.64	0.10	0.10
   query5	0.43	0.41	0.41
   query6	1.15	0.66	0.66
   query7	0.02	0.01	0.02
   query8	0.03	0.03	0.03
   query9	0.56	0.50	0.48
   query10	0.56	0.56	0.55
   query11	0.14	0.10	0.11
   query12	0.13	0.13	0.11
   query13	0.61	0.60	0.59
   query14	2.73	2.85	2.73
   query15	0.90	0.82	0.81
   query16	0.38	0.38	0.39
   query17	1.06	1.05	1.08
   query18	0.20	0.19	0.20
   query19	1.86	1.84	1.94
   query20	0.02	0.01	0.01
   query21	15.36	0.60	0.59
   query22	2.42	2.19	2.73
   query23	17.20	0.92	0.86
   query24	3.20	0.80	0.96
   query25	0.29	0.12	0.13
   query26	0.50	0.14	0.13
   query27	0.05	0.04	0.04
   query28	10.83	1.08	1.06
   query29	12.60	3.32	3.29
   query30	0.24	0.06	0.06
   query31	2.88	0.38	0.37
   query32	3.29	0.47	0.45
   query33	3.02	3.01	3.03
   query34	16.92	4.41	4.44
   query35	4.50	4.53	4.47
   query36	0.67	0.48	0.48
   query37	0.09	0.06	0.06
   query38	0.05	0.04	0.03
   query39	0.03	0.02	0.02
   query40	0.15	0.12	0.12
   query41	0.08	0.02	0.02
   query42	0.03	0.03	0.02
   query43	0.03	0.03	0.03
   Total cold run time: 107.17 s
   Total hot run time: 32.8 s
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow commented on code in PR #41913:
URL: https://github.com/apache/doris/pull/41913#discussion_r1818722017


##########
fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4:
##########
@@ -820,7 +820,7 @@ optionWithoutType
     | NAMES (charsetName=identifierOrText | DEFAULT)
         (COLLATE collateName=identifierOrText | DEFAULT)?               #setCollate
     | PASSWORD (FOR userIdentify)? EQ (STRING_LITERAL
-        | (PASSWORD LEFT_PAREN STRING_LITERAL RIGHT_PAREN))             #setPassword
+        | (isPlain=PASSWORD LEFT_PAREN STRING_LITERAL RIGHT_PAREN))             #setPassword

Review Comment:
   maybe should be `isNotPlain` ?



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -3829,4 +3855,111 @@ public LogicalPlan visitShowConfig(ShowConfigContext ctx) {
         }
         return command;
     }
+
+    @Override
+    public SetOptionsCommand visitSetOptions(SetOptionsContext ctx) {
+        List<SetVarOp> setVarOpList = new ArrayList<>(1);
+        for (Object child : ctx.children) {
+            if (child instanceof RuleNode) {
+                setVarOpList.add(typedVisit((RuleNode) child));
+            }
+        }
+        return new SetOptionsCommand(setVarOpList);
+    }
+
+    @Override
+    public SetVarOp visitSetSystemVariable(SetSystemVariableContext ctx) {
+        SetType type = SetType.DEFAULT;
+        if (ctx.GLOBAL() != null) {
+            type = SetType.GLOBAL;
+        } else if (ctx.LOCAL() != null || ctx.SESSION() != null) {
+            type = SetType.SESSION;
+        }
+        String name = stripQuotes(ctx.identifier().getText());
+        Expression expression = ctx.expression() != null ? typedVisit(ctx.expression()) : null;
+        return new SetSessionVarOp(type, name, expression);
+    }
+
+    @Override
+    public SetVarOp visitSetVariableWithType(SetVariableWithTypeContext ctx) {
+        SetType type = SetType.DEFAULT;
+        if (ctx.GLOBAL() != null) {
+            type = SetType.GLOBAL;
+        } else if (ctx.LOCAL() != null || ctx.SESSION() != null) {
+            type = SetType.SESSION;
+        }
+        String name = stripQuotes(ctx.identifier().getText());
+        Expression expression = ctx.expression() != null ? typedVisit(ctx.expression()) : null;
+        return new SetSessionVarOp(type, name, expression);
+    }
+
+    @Override
+    public SetVarOp visitSetPassword(SetPasswordContext ctx) {
+        String user;
+        String host;
+        boolean isDomain;
+        String passwordText;
+        UserIdentity userIdentity = null;
+        if (ctx.userIdentify() != null) {
+            user = stripQuotes(ctx.userIdentify().user.getText());
+            host = ctx.userIdentify().host != null ? stripQuotes(ctx.userIdentify().host.getText()) : "%";
+            isDomain = ctx.userIdentify().ATSIGN() != null;
+            userIdentity = new UserIdentity(user, host, isDomain);
+        }
+        passwordText = stripQuotes(ctx.STRING_LITERAL().getText());
+        return new SetPassVarOp(userIdentity, new PassVar(passwordText, ctx.isPlain != null));

Review Comment:
   ```suggestion
           return new SetPassVarOp(userIdentity, new PassVar(passwordText, ctx.isNotPlain == null));
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -3829,4 +3855,111 @@ public LogicalPlan visitShowConfig(ShowConfigContext ctx) {
         }
         return command;
     }
+
+    @Override
+    public SetOptionsCommand visitSetOptions(SetOptionsContext ctx) {
+        List<SetVarOp> setVarOpList = new ArrayList<>(1);
+        for (Object child : ctx.children) {
+            if (child instanceof RuleNode) {
+                setVarOpList.add(typedVisit((RuleNode) child));
+            }
+        }
+        return new SetOptionsCommand(setVarOpList);
+    }
+
+    @Override
+    public SetVarOp visitSetSystemVariable(SetSystemVariableContext ctx) {
+        SetType type = SetType.DEFAULT;
+        if (ctx.GLOBAL() != null) {
+            type = SetType.GLOBAL;
+        } else if (ctx.LOCAL() != null || ctx.SESSION() != null) {
+            type = SetType.SESSION;
+        }
+        String name = stripQuotes(ctx.identifier().getText());
+        Expression expression = ctx.expression() != null ? typedVisit(ctx.expression()) : null;
+        return new SetSessionVarOp(type, name, expression);
+    }
+
+    @Override
+    public SetVarOp visitSetVariableWithType(SetVariableWithTypeContext ctx) {
+        SetType type = SetType.DEFAULT;
+        if (ctx.GLOBAL() != null) {
+            type = SetType.GLOBAL;
+        } else if (ctx.LOCAL() != null || ctx.SESSION() != null) {
+            type = SetType.SESSION;
+        }
+        String name = stripQuotes(ctx.identifier().getText());
+        Expression expression = ctx.expression() != null ? typedVisit(ctx.expression()) : null;
+        return new SetSessionVarOp(type, name, expression);
+    }
+
+    @Override
+    public SetVarOp visitSetPassword(SetPasswordContext ctx) {
+        String user;
+        String host;
+        boolean isDomain;
+        String passwordText;
+        UserIdentity userIdentity = null;
+        if (ctx.userIdentify() != null) {
+            user = stripQuotes(ctx.userIdentify().user.getText());
+            host = ctx.userIdentify().host != null ? stripQuotes(ctx.userIdentify().host.getText()) : "%";
+            isDomain = ctx.userIdentify().ATSIGN() != null;
+            userIdentity = new UserIdentity(user, host, isDomain);
+        }
+        passwordText = stripQuotes(ctx.STRING_LITERAL().getText());
+        return new SetPassVarOp(userIdentity, new PassVar(passwordText, ctx.isPlain != null));
+    }
+
+    @Override
+    public SetVarOp visitSetNames(SetNamesContext ctx) {
+        return new SetNamesVarOp();
+    }
+
+    @Override
+    public SetVarOp visitSetCharset(SetCharsetContext ctx) {
+        String charset = ctx.charsetName != null ? stripQuotes(ctx.charsetName.getText()) : null;
+        return new SetCharsetAndCollateVarOp(charset);
+    }
+
+    @Override
+    public SetVarOp visitSetCollate(SetCollateContext ctx) {
+        String charset = ctx.charsetName != null ? stripQuotes(ctx.charsetName.getText()) : null;
+        String collate = ctx.collateName != null ? stripQuotes(ctx.collateName.getText()) : null;
+        return new SetCharsetAndCollateVarOp(charset, collate);
+    }
+
+    @Override
+    public SetVarOp visitSetLdapAdminPassword(SetLdapAdminPasswordContext ctx) {
+        String passwordText = stripQuotes(ctx.STRING_LITERAL().getText());
+        boolean isPlain = ctx.PASSWORD() != null;

Review Comment:
   ```suggestion
           boolean isPlain = ctx.PASSWORD() == null;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "starocean999 (via GitHub)" <gi...@apache.org>.
starocean999 commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2437845851

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "starocean999 (via GitHub)" <gi...@apache.org>.
starocean999 commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2437841933

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2416582711

   
   <details>
   <summary>ClickBench: <b>Total hot run time: 32.5 s</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
   ClickBench test result on commit 879c0e2bab46b0dd2ae3dbd9ec12409304770be0, data reload: false
   
   query1	0.03	0.03	0.03
   query2	0.06	0.03	0.03
   query3	0.23	0.07	0.07
   query4	1.64	0.10	0.10
   query5	0.52	0.52	0.48
   query6	1.13	0.73	0.73
   query7	0.02	0.02	0.01
   query8	0.04	0.03	0.03
   query9	0.57	0.50	0.48
   query10	0.55	0.55	0.53
   query11	0.14	0.11	0.10
   query12	0.14	0.11	0.11
   query13	0.61	0.60	0.60
   query14	2.79	2.73	2.83
   query15	0.91	0.83	0.84
   query16	0.39	0.42	0.38
   query17	1.07	1.08	1.04
   query18	0.20	0.19	0.19
   query19	1.85	1.76	2.00
   query20	0.01	0.01	0.01
   query21	15.37	0.58	0.57
   query22	2.58	2.10	1.67
   query23	17.08	0.87	0.99
   query24	3.26	0.98	1.47
   query25	0.21	0.09	0.21
   query26	0.47	0.14	0.13
   query27	0.04	0.04	0.03
   query28	10.24	1.11	1.07
   query29	12.55	3.28	3.27
   query30	0.24	0.06	0.06
   query31	2.87	0.39	0.38
   query32	3.26	0.47	0.46
   query33	3.01	3.08	3.01
   query34	17.17	4.44	4.45
   query35	4.52	4.48	4.50
   query36	0.68	0.49	0.48
   query37	0.08	0.05	0.06
   query38	0.04	0.03	0.04
   query39	0.02	0.02	0.03
   query40	0.15	0.11	0.13
   query41	0.08	0.02	0.02
   query42	0.04	0.02	0.02
   query43	0.03	0.02	0.02
   Total cold run time: 106.89 s
   Total hot run time: 32.5 s
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "starocean999 (via GitHub)" <gi...@apache.org>.
starocean999 commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2437015794

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2445698305

   
   <details>
   <summary>ClickBench: <b>Total hot run time: 32.78 s</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
   ClickBench test result on commit 028fd7c377d0e3bd155f16bf23a861da82ba489e, data reload: false
   
   query1	0.03	0.03	0.03
   query2	0.07	0.03	0.03
   query3	0.22	0.06	0.06
   query4	1.65	0.10	0.10
   query5	0.41	0.41	0.41
   query6	1.15	0.66	0.65
   query7	0.02	0.02	0.02
   query8	0.03	0.03	0.03
   query9	0.57	0.51	0.49
   query10	0.56	0.55	0.55
   query11	0.15	0.12	0.11
   query12	0.13	0.13	0.11
   query13	0.62	0.58	0.60
   query14	2.70	2.80	2.80
   query15	0.90	0.82	0.82
   query16	0.38	0.37	0.37
   query17	1.03	1.01	1.07
   query18	0.20	0.19	0.20
   query19	1.97	1.75	1.95
   query20	0.01	0.01	0.00
   query21	15.36	0.58	0.58
   query22	2.59	2.02	2.42
   query23	16.98	1.13	0.72
   query24	3.14	1.06	1.19
   query25	0.23	0.15	0.09
   query26	0.58	0.14	0.14
   query27	0.04	0.04	0.05
   query28	10.69	1.10	1.07
   query29	12.57	3.31	3.28
   query30	0.25	0.06	0.06
   query31	2.89	0.39	0.39
   query32	3.27	0.46	0.45
   query33	3.02	3.09	3.05
   query34	17.04	4.48	4.50
   query35	4.51	4.50	4.46
   query36	0.66	0.50	0.48
   query37	0.09	0.06	0.06
   query38	0.05	0.03	0.04
   query39	0.03	0.02	0.03
   query40	0.15	0.12	0.12
   query41	0.07	0.02	0.02
   query42	0.04	0.02	0.02
   query43	0.03	0.03	0.03
   Total cold run time: 107.08 s
   Total hot run time: 32.78 s
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2445987585

   PR approved by at least one committer and no changes requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "starocean999 (via GitHub)" <gi...@apache.org>.
starocean999 commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2413913873

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2413913759

   Thank you for your contribution to Apache Doris.
   Don't know what should be done next? See [How to process your PR](https://cwiki.apache.org/confluence/display/DORIS/How+to+process+your+PR)
   
   Since 2024-03-18, the Document has been moved to [doris-website](https://github.com/apache/doris-website).
   See [Doris Document](https://cwiki.apache.org/confluence/display/DORIS/Doris+Document).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "starocean999 (via GitHub)" <gi...@apache.org>.
starocean999 commented on code in PR #41913:
URL: https://github.com/apache/doris/pull/41913#discussion_r1804319316


##########
fe/fe-core/src/main/java/org/apache/doris/qe/AuditLogHelper.java:
##########
@@ -259,10 +260,20 @@ private static void logAuditLogImpl(ConnectContext ctx, String origStmt, Stateme
         auditEventBuilder.setFeIp(FrontendOptions.getLocalHostAddress());
 
         // We put origin query stmt at the end of audit log, for parsing the log more convenient.
-        if (!ctx.getState().isQuery() && (parsedStmt != null && parsedStmt.needAuditEncryption())) {
-            auditEventBuilder.setStmt(parsedStmt.toSql());
+        if (parsedStmt instanceof LogicalPlanAdapter) {
+            if (!ctx.getState().isQuery() && (parsedStmt != null
+                    && (((LogicalPlanAdapter) parsedStmt).getLogicalPlan() instanceof Command))
+                    && ((Command) ((LogicalPlanAdapter) parsedStmt).getLogicalPlan()).needAuditEncryption()) {

Review Comment:
   use trait here toSql and needAuditEncryption() must be implemented together



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2414065493

   
   <details>
   <summary>TPC-DS: <b>Total hot run time: 191809 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
   TPC-DS sf100 test result on commit 001bcb0a343b9836cdd79713723a3ad10988babf, data reload: false
   
   query1	965	383	402	383
   query2	6246	2199	2076	2076
   query3	8685	199	203	199
   query4	34031	23789	23529	23529
   query5	3439	473	464	464
   query6	267	166	173	166
   query7	4189	299	288	288
   query8	287	228	222	222
   query9	9222	2751	2713	2713
   query10	469	280	271	271
   query11	17884	15211	15425	15211
   query12	158	102	109	102
   query13	1571	428	422	422
   query14	10255	7069	7227	7069
   query15	253	173	189	173
   query16	7965	480	454	454
   query17	1607	607	579	579
   query18	1995	312	311	311
   query19	311	161	174	161
   query20	124	114	114	114
   query21	213	105	111	105
   query22	4753	4682	4426	4426
   query23	35163	34871	33928	33928
   query24	11497	2792	2721	2721
   query25	647	406	399	399
   query26	1714	158	166	158
   query27	2562	280	284	280
   query28	7795	2429	2421	2421
   query29	996	440	418	418
   query30	267	161	164	161
   query31	1048	807	795	795
   query32	103	59	57	57
   query33	770	313	300	300
   query34	922	533	519	519
   query35	909	768	758	758
   query36	1099	952	974	952
   query37	198	88	91	88
   query38	4060	3899	3909	3899
   query39	1489	1450	1424	1424
   query40	259	97	100	97
   query41	48	46	48	46
   query42	128	102	100	100
   query43	543	506	496	496
   query44	1240	820	823	820
   query45	195	165	169	165
   query46	1166	696	701	696
   query47	1934	1822	1825	1822
   query48	424	320	324	320
   query49	1036	438	434	434
   query50	814	383	403	383
   query51	7145	7048	6969	6969
   query52	104	90	87	87
   query53	259	180	182	180
   query54	1245	435	444	435
   query55	83	81	81	81
   query56	302	278	256	256
   query57	1293	1114	1161	1114
   query58	239	230	236	230
   query59	3179	3183	3043	3043
   query60	307	280	274	274
   query61	130	104	100	100
   query62	839	672	646	646
   query63	224	183	185	183
   query64	4868	659	609	609
   query65	3289	3176	3206	3176
   query66	1106	305	319	305
   query67	16273	15670	15846	15670
   query68	4314	570	571	570
   query69	499	282	284	282
   query70	1180	1139	1145	1139
   query71	329	275	299	275
   query72	7279	3997	4188	3997
   query73	772	352	361	352
   query74	10166	9000	9005	9000
   query75	3459	2682	2635	2635
   query76	3062	912	901	901
   query77	596	302	283	283
   query78	10548	9681	9567	9567
   query79	2484	614	614	614
   query80	2668	470	485	470
   query81	604	244	250	244
   query82	708	156	140	140
   query83	312	142	136	136
   query84	289	71	72	71
   query85	1386	300	295	295
   query86	395	299	310	299
   query87	4444	4292	4293	4292
   query88	3309	2228	2190	2190
   query89	419	292	295	292
   query90	1974	189	189	189
   query91	138	101	101	101
   query92	56	47	48	47
   query93	1946	541	534	534
   query94	936	292	261	261
   query95	344	241	252	241
   query96	622	284	288	284
   query97	3259	3142	3165	3142
   query98	220	202	193	193
   query99	1573	1320	1328	1320
   Total cold run time: 305090 ms
   Total hot run time: 191809 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2417182055

   
   <details>
   <summary>TPC-DS: <b>Total hot run time: 193028 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
   TPC-DS sf100 test result on commit 67f39710dcd6cb1ef3a4054d604a7278a7cdbde0, data reload: false
   
   query1	885	388	393	388
   query2	6283	2140	2028	2028
   query3	8683	189	191	189
   query4	34281	23754	23544	23544
   query5	3564	500	471	471
   query6	291	170	168	168
   query7	4164	296	287	287
   query8	286	234	233	233
   query9	9057	2723	2715	2715
   query10	449	275	278	275
   query11	18085	15319	15213	15213
   query12	150	105	98	98
   query13	1562	431	402	402
   query14	9798	7674	7555	7555
   query15	251	169	179	169
   query16	7984	452	481	452
   query17	1673	604	577	577
   query18	2119	320	310	310
   query19	387	160	159	159
   query20	126	113	118	113
   query21	213	106	109	106
   query22	4553	4683	4514	4514
   query23	35817	34692	34839	34692
   query24	10588	2786	2831	2786
   query25	531	416	401	401
   query26	705	173	179	173
   query27	1965	288	288	288
   query28	6276	2456	2408	2408
   query29	672	445	431	431
   query30	257	169	150	150
   query31	1071	793	818	793
   query32	102	56	56	56
   query33	679	300	327	300
   query34	948	519	518	518
   query35	915	746	754	746
   query36	1169	957	947	947
   query37	147	88	90	88
   query38	4075	4079	3997	3997
   query39	1504	1414	1426	1414
   query40	210	99	100	99
   query41	47	47	48	47
   query42	128	107	103	103
   query43	537	501	499	499
   query44	1187	814	811	811
   query45	199	164	170	164
   query46	1149	705	722	705
   query47	1928	1820	1834	1820
   query48	432	326	328	326
   query49	902	431	428	428
   query50	848	393	403	393
   query51	7173	6978	7090	6978
   query52	104	94	94	94
   query53	268	183	180	180
   query54	1214	426	435	426
   query55	84	80	79	79
   query56	301	304	262	262
   query57	1263	1136	1148	1136
   query58	250	237	236	236
   query59	3078	3085	2988	2988
   query60	298	274	276	274
   query61	103	100	98	98
   query62	825	691	689	689
   query63	219	196	183	183
   query64	3708	643	602	602
   query65	3308	3215	3210	3210
   query66	724	328	307	307
   query67	15731	15647	15498	15498
   query68	4426	572	570	570
   query69	527	293	298	293
   query70	1188	1065	1100	1065
   query71	344	299	272	272
   query72	7348	3996	3741	3741
   query73	827	366	365	365
   query74	10293	9021	9009	9009
   query75	3479	2681	2692	2681
   query76	3227	890	880	880
   query77	614	304	299	299
   query78	10498	9738	9609	9609
   query79	2228	615	629	615
   query80	1094	452	467	452
   query81	588	243	244	243
   query82	686	141	137	137
   query83	296	137	137	137
   query84	277	73	69	69
   query85	1321	299	285	285
   query86	426	295	290	290
   query87	4473	4468	4372	4372
   query88	3334	2252	2205	2205
   query89	421	301	305	301
   query90	2032	194	185	185
   query91	136	103	101	101
   query92	61	53	50	50
   query93	2643	537	541	537
   query94	851	286	303	286
   query95	350	264	254	254
   query96	650	278	283	278
   query97	3233	3178	3139	3139
   query98	224	201	199	199
   query99	1700	1324	1320	1320
   Total cold run time: 298278 ms
   Total hot run time: 193028 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2417197862

   
   <details>
   <summary>ClickBench: <b>Total hot run time: 32.55 s</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
   ClickBench test result on commit 67f39710dcd6cb1ef3a4054d604a7278a7cdbde0, data reload: false
   
   query1	0.04	0.04	0.03
   query2	0.06	0.03	0.03
   query3	0.23	0.06	0.07
   query4	1.65	0.10	0.10
   query5	0.53	0.50	0.53
   query6	1.14	0.74	0.73
   query7	0.01	0.01	0.01
   query8	0.03	0.03	0.03
   query9	0.57	0.51	0.48
   query10	0.56	0.53	0.56
   query11	0.14	0.10	0.10
   query12	0.14	0.10	0.10
   query13	0.60	0.60	0.59
   query14	2.81	2.83	2.69
   query15	0.89	0.81	0.84
   query16	0.40	0.39	0.37
   query17	1.05	1.09	1.00
   query18	0.20	0.20	0.20
   query19	1.97	1.88	2.02
   query20	0.02	0.00	0.01
   query21	15.36	0.58	0.59
   query22	2.72	2.58	2.04
   query23	17.05	1.01	0.82
   query24	3.14	0.66	1.26
   query25	0.41	0.09	0.13
   query26	0.32	0.15	0.13
   query27	0.04	0.04	0.03
   query28	10.85	1.09	1.07
   query29	12.54	3.29	3.27
   query30	0.24	0.06	0.05
   query31	2.89	0.38	0.37
   query32	3.28	0.46	0.45
   query33	3.00	3.03	3.03
   query34	16.97	4.47	4.45
   query35	4.55	4.53	4.50
   query36	0.68	0.51	0.49
   query37	0.08	0.05	0.06
   query38	0.05	0.03	0.03
   query39	0.03	0.02	0.02
   query40	0.15	0.13	0.12
   query41	0.07	0.02	0.02
   query42	0.04	0.02	0.02
   query43	0.03	0.02	0.03
   Total cold run time: 107.53 s
   Total hot run time: 32.55 s
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2422068372

   
   <details>
   <summary>TPC-DS: <b>Total hot run time: 192427 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
   TPC-DS sf100 test result on commit 45e4fc2e3327fb9fd9d3640f975d672d13109104, data reload: false
   
   query1	832	399	403	399
   query2	6286	2188	2044	2044
   query3	8682	190	198	190
   query4	33983	23683	23557	23557
   query5	3442	492	478	478
   query6	274	170	176	170
   query7	4210	298	293	293
   query8	296	236	243	236
   query9	9555	2705	2700	2700
   query10	448	269	265	265
   query11	17864	15372	15187	15187
   query12	157	102	102	102
   query13	1566	426	407	407
   query14	10429	7495	7314	7314
   query15	244	171	179	171
   query16	7972	496	483	483
   query17	1558	578	549	549
   query18	2131	286	308	286
   query19	370	156	146	146
   query20	122	113	114	113
   query21	210	110	105	105
   query22	4719	4562	4524	4524
   query23	34882	34128	33953	33953
   query24	10928	2765	2679	2679
   query25	573	384	374	374
   query26	967	149	154	149
   query27	2172	290	282	282
   query28	7109	2390	2393	2390
   query29	781	407	389	389
   query30	280	149	152	149
   query31	1056	789	784	784
   query32	99	52	55	52
   query33	763	281	294	281
   query34	919	510	508	508
   query35	895	720	725	720
   query36	1120	932	920	920
   query37	153	83	87	83
   query38	4063	3889	4014	3889
   query39	1664	1417	1423	1417
   query40	203	95	95	95
   query41	46	43	43	43
   query42	124	98	96	96
   query43	534	491	501	491
   query44	1274	810	798	798
   query45	196	163	164	163
   query46	1146	710	700	700
   query47	1951	1868	1877	1868
   query48	417	306	318	306
   query49	905	424	422	422
   query50	823	387	391	387
   query51	7169	7008	6925	6925
   query52	98	90	89	89
   query53	255	181	190	181
   query54	1284	436	421	421
   query55	78	82	76	76
   query56	271	261	271	261
   query57	1317	1172	1161	1161
   query58	223	250	244	244
   query59	3331	2938	2962	2938
   query60	299	262	256	256
   query61	130	111	120	111
   query62	859	690	657	657
   query63	228	192	190	190
   query64	3992	728	707	707
   query65	3313	3236	3246	3236
   query66	803	315	314	314
   query67	16074	16136	17231	16136
   query68	4682	613	570	570
   query69	1268	324	318	318
   query70	1227	1162	1126	1126
   query71	791	286	307	286
   query72	9077	4156	4079	4079
   query73	795	370	370	370
   query74	10892	9047	9013	9013
   query75	3477	2631	2669	2631
   query76	3303	895	892	892
   query77	644	323	305	305
   query78	10563	9665	9532	9532
   query79	2746	605	621	605
   query80	1228	437	447	437
   query81	582	238	237	237
   query82	610	143	141	141
   query83	289	134	131	131
   query84	277	74	69	69
   query85	1822	300	285	285
   query86	506	307	310	307
   query87	4529	4326	4299	4299
   query88	3662	2218	2189	2189
   query89	403	294	283	283
   query90	2028	185	189	185
   query91	146	103	97	97
   query92	69	50	48	48
   query93	2319	540	534	534
   query94	985	279	274	274
   query95	349	247	246	246
   query96	620	279	282	279
   query97	3263	3172	3145	3145
   query98	214	199	193	193
   query99	1587	1311	1335	1311
   Total cold run time: 306070 ms
   Total hot run time: 192427 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "starocean999 (via GitHub)" <gi...@apache.org>.
starocean999 merged PR #41913:
URL: https://github.com/apache/doris/pull/41913


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow commented on code in PR #41913:
URL: https://github.com/apache/doris/pull/41913#discussion_r1804735922


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -3809,4 +3835,113 @@ public LogicalPlan visitShowConfig(ShowConfigContext ctx) {
         }
         return command;
     }
+
+    @Override
+    public SetOptionsCommand visitSetOptions(SetOptionsContext ctx) {
+        List<SetVarOp> setVarOpList = new ArrayList<>(1);
+        for (Object child : ctx.children) {
+            if (child instanceof RuleNode) {
+                setVarOpList.add((SetVarOp) ((RuleNode) child).accept(this));

Review Comment:
   maybe could use `typedVisit`
   ```
   setVarOpList.add(typedVisit((RuleNode) child));
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -3809,4 +3835,113 @@ public LogicalPlan visitShowConfig(ShowConfigContext ctx) {
         }
         return command;
     }
+
+    @Override
+    public SetOptionsCommand visitSetOptions(SetOptionsContext ctx) {
+        List<SetVarOp> setVarOpList = new ArrayList<>(1);
+        for (Object child : ctx.children) {
+            if (child instanceof RuleNode) {
+                setVarOpList.add((SetVarOp) ((RuleNode) child).accept(this));
+            }
+        }
+        return new SetOptionsCommand(setVarOpList);
+    }
+
+    @Override
+    public SetSessionVarOp visitSetSystemVariable(SetSystemVariableContext ctx) {

Review Comment:
   ```suggestion
       public SetVarOp visitSetSystemVariable(SetSystemVariableContext ctx) {
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -3809,4 +3835,113 @@ public LogicalPlan visitShowConfig(ShowConfigContext ctx) {
         }
         return command;
     }
+
+    @Override
+    public SetOptionsCommand visitSetOptions(SetOptionsContext ctx) {
+        List<SetVarOp> setVarOpList = new ArrayList<>(1);
+        for (Object child : ctx.children) {
+            if (child instanceof RuleNode) {
+                setVarOpList.add((SetVarOp) ((RuleNode) child).accept(this));
+            }
+        }
+        return new SetOptionsCommand(setVarOpList);
+    }
+
+    @Override
+    public SetSessionVarOp visitSetSystemVariable(SetSystemVariableContext ctx) {
+        SetType type = SetType.DEFAULT;
+        if (ctx.GLOBAL() != null) {
+            type = SetType.GLOBAL;
+        } else if (ctx.LOCAL() != null || ctx.SESSION() != null) {
+            type = SetType.SESSION;
+        }
+        String name = stripQuotes(ctx.identifier().getText());
+        Expression expression = ctx.expression() != null ? typedVisit(ctx.expression()) : NullLiteral.INSTANCE;
+        return new SetSessionVarOp(type, name, expression);
+    }
+
+    @Override
+    public SetSessionVarOp visitSetVariableWithType(SetVariableWithTypeContext ctx) {

Review Comment:
   ```suggestion
       public SetVarOp visitSetVariableWithType(SetVariableWithTypeContext ctx) {
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/SetOptionsCommand.java:
##########
@@ -0,0 +1,105 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.trees.plans.commands;
+
+import org.apache.doris.analysis.RedirectStatus;
+import org.apache.doris.analysis.SetType;
+import org.apache.doris.analysis.StmtType;
+import org.apache.doris.nereids.trees.plans.PlanType;
+import org.apache.doris.nereids.trees.plans.commands.info.SetLdapPassVarOp;
+import org.apache.doris.nereids.trees.plans.commands.info.SetPassVarOp;
+import org.apache.doris.nereids.trees.plans.commands.info.SetVarOp;
+import org.apache.doris.nereids.trees.plans.visitor.PlanVisitor;
+import org.apache.doris.qe.ConnectContext;
+import org.apache.doris.qe.StmtExecutor;
+
+import java.util.List;
+
+/**
+ * SetOptionsCommand
+ */
+public class SetOptionsCommand extends Command implements ForwardWithSync {

Review Comment:
   in `StmtExecutor#L707`, we use `instance of Forward` to decide whether to forward to master. we should use toRedirectStatus result decide it.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/SetOptionsCommand.java:
##########
@@ -0,0 +1,105 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.trees.plans.commands;
+
+import org.apache.doris.analysis.RedirectStatus;
+import org.apache.doris.analysis.SetType;
+import org.apache.doris.analysis.StmtType;
+import org.apache.doris.nereids.trees.plans.PlanType;
+import org.apache.doris.nereids.trees.plans.commands.info.SetLdapPassVarOp;
+import org.apache.doris.nereids.trees.plans.commands.info.SetPassVarOp;
+import org.apache.doris.nereids.trees.plans.commands.info.SetVarOp;
+import org.apache.doris.nereids.trees.plans.visitor.PlanVisitor;
+import org.apache.doris.qe.ConnectContext;
+import org.apache.doris.qe.StmtExecutor;
+
+import java.util.List;
+
+/**
+ * SetOptionsCommand
+ */
+public class SetOptionsCommand extends Command implements ForwardWithSync {

Review Comment:
   ```suggestion
   public class SetOptionsCommand extends Command implements Forward {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "starocean999 (via GitHub)" <gi...@apache.org>.
starocean999 commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2445636371

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2437093104

   
   <details>
   <summary>TPC-H: <b>Total hot run time: 41365 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
   Tpch sf100 test result on commit 963a879b7a168556fd3e0536aa889c010c8a4245, data reload: false
   
   ------ Round 1 ----------------------------------
   q1	17569	7450	7410	7410
   q2	2067	154	163	154
   q3	10566	1124	1160	1124
   q4	10224	888	787	787
   q5	7732	3102	3063	3063
   q6	234	148	147	147
   q7	1010	604	603	603
   q8	9352	1947	1972	1947
   q9	6622	6394	6463	6394
   q10	7090	2408	2453	2408
   q11	449	260	250	250
   q12	407	210	218	210
   q13	17760	3011	2985	2985
   q14	241	209	211	209
   q15	606	523	506	506
   q16	624	580	578	578
   q17	962	556	513	513
   q18	7341	6721	6605	6605
   q19	1327	1049	1058	1049
   q20	470	185	183	183
   q21	3994	3271	3222	3222
   q22	1106	1040	1018	1018
   Total cold run time: 107753 ms
   Total hot run time: 41365 ms
   
   ----- Round 2, with runtime_filter_mode=off -----
   q1	7397	7308	7361	7308
   q2	336	227	236	227
   q3	2951	2794	2853	2794
   q4	1920	1704	1658	1658
   q5	5443	5487	5521	5487
   q6	216	139	139	139
   q7	2141	1741	1724	1724
   q8	3244	3454	3453	3453
   q9	8517	8560	8570	8560
   q10	3538	3473	3442	3442
   q11	591	477	492	477
   q12	798	563	619	563
   q13	9330	3017	3028	3017
   q14	310	260	285	260
   q15	561	509	503	503
   q16	668	648	634	634
   q17	1828	1587	1550	1550
   q18	7785	7557	7489	7489
   q19	1669	1507	1469	1469
   q20	2046	1818	1836	1818
   q21	5410	5206	5150	5150
   q22	1101	1036	1031	1031
   Total cold run time: 67800 ms
   Total hot run time: 58753 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2437114332

   
   <details>
   <summary>TPC-DS: <b>Total hot run time: 191541 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
   TPC-DS sf100 test result on commit 963a879b7a168556fd3e0536aa889c010c8a4245, data reload: false
   
   query1	970	374	375	374
   query2	6517	2085	2063	2063
   query3	6780	212	227	212
   query4	34303	23579	23641	23579
   query5	4395	447	463	447
   query6	265	170	169	169
   query7	4607	291	288	288
   query8	290	237	236	236
   query9	9546	2662	2659	2659
   query10	468	262	251	251
   query11	18149	15161	15302	15161
   query12	162	111	103	103
   query13	1674	426	416	416
   query14	10079	7006	6941	6941
   query15	262	172	189	172
   query16	7843	472	448	448
   query17	1654	558	589	558
   query18	2120	305	299	299
   query19	369	160	154	154
   query20	121	112	109	109
   query21	213	103	104	103
   query22	4614	4291	4341	4291
   query23	34768	34603	34043	34043
   query24	11147	2791	2728	2728
   query25	659	393	408	393
   query26	1482	161	159	159
   query27	2800	280	301	280
   query28	8049	2417	2411	2411
   query29	970	423	425	423
   query30	332	175	157	157
   query31	1018	798	839	798
   query32	99	59	57	57
   query33	769	282	283	282
   query34	965	529	511	511
   query35	1039	906	868	868
   query36	1118	937	954	937
   query37	134	77	77	77
   query38	4422	4256	4205	4205
   query39	1492	1423	1404	1404
   query40	289	101	101	101
   query41	51	52	48	48
   query42	110	99	96	96
   query43	524	496	478	478
   query44	1330	816	811	811
   query45	183	166	163	163
   query46	1140	681	719	681
   query47	1913	1814	1836	1814
   query48	412	317	330	317
   query49	1253	410	419	410
   query50	807	394	394	394
   query51	7014	7038	7090	7038
   query52	99	91	89	89
   query53	255	179	179	179
   query54	1192	409	440	409
   query55	78	78	82	78
   query56	269	255	253	253
   query57	1338	1182	1164	1164
   query58	235	231	208	208
   query59	3231	3064	3163	3064
   query60	270	248	253	248
   query61	102	99	100	99
   query62	869	686	675	675
   query63	211	194	185	185
   query64	5232	633	580	580
   query65	3280	3261	3195	3195
   query66	1453	309	299	299
   query67	16174	15729	15674	15674
   query68	4999	552	550	550
   query69	434	252	255	252
   query70	1176	1178	1174	1174
   query71	433	265	266	265
   query72	6328	3972	3984	3972
   query73	763	364	384	364
   query74	10602	8907	8992	8907
   query75	3414	2646	2686	2646
   query76	2937	1045	954	954
   query77	454	269	271	269
   query78	10505	9578	9577	9577
   query79	1591	588	591	588
   query80	1075	435	414	414
   query81	547	240	244	240
   query82	928	119	120	119
   query83	210	142	137	137
   query84	232	70	76	70
   query85	1233	304	284	284
   query86	359	301	299	299
   query87	4825	4651	4645	4645
   query88	3346	2211	2174	2174
   query89	407	298	291	291
   query90	1927	182	186	182
   query91	136	102	101	101
   query92	59	49	49	49
   query93	1137	522	531	522
   query94	877	300	292	292
   query95	339	246	245	245
   query96	603	282	279	279
   query97	2900	2667	2704	2667
   query98	207	194	191	191
   query99	1524	1314	1306	1306
   Total cold run time: 302485 ms
   Total hot run time: 191541 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "starocean999 (via GitHub)" <gi...@apache.org>.
starocean999 commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2416452032

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2414031476

   
   <details>
   <summary>TPC-H: <b>Total hot run time: 40968 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
   Tpch sf100 test result on commit 001bcb0a343b9836cdd79713723a3ad10988babf, data reload: false
   
   ------ Round 1 ----------------------------------
   q1	17565	7463	7245	7245
   q2	2020	282	274	274
   q3	12046	1060	1176	1060
   q4	10583	881	856	856
   q5	7770	3093	3018	3018
   q6	234	150	150	150
   q7	997	600	599	599
   q8	9364	1927	1956	1927
   q9	6552	6465	6392	6392
   q10	7060	2423	2444	2423
   q11	439	231	243	231
   q12	413	221	221	221
   q13	17775	2990	2983	2983
   q14	248	207	231	207
   q15	564	536	520	520
   q16	637	582	602	582
   q17	968	543	470	470
   q18	7345	6639	6601	6601
   q19	1343	972	982	972
   q20	477	184	183	183
   q21	4025	3085	3188	3085
   q22	1094	998	969	969
   Total cold run time: 109519 ms
   Total hot run time: 40968 ms
   
   ----- Round 2, with runtime_filter_mode=off -----
   q1	7254	7217	7188	7188
   q2	325	230	236	230
   q3	3002	2954	2945	2945
   q4	2110	1776	1788	1776
   q5	5781	5748	5750	5748
   q6	240	148	149	148
   q7	2214	1898	1801	1801
   q8	3367	3554	3407	3407
   q9	8930	8913	8860	8860
   q10	3562	3589	3530	3530
   q11	582	489	493	489
   q12	810	648	644	644
   q13	11258	3191	3167	3167
   q14	293	280	269	269
   q15	584	524	527	524
   q16	701	660	638	638
   q17	1859	1615	1612	1612
   q18	8258	7776	7467	7467
   q19	1715	1521	1485	1485
   q20	2143	1920	1888	1888
   q21	5468	5304	5510	5304
   q22	1110	1061	1033	1033
   Total cold run time: 71566 ms
   Total hot run time: 60153 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "starocean999 (via GitHub)" <gi...@apache.org>.
starocean999 commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2421929196

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2445693199

   
   <details>
   <summary>TPC-DS: <b>Total hot run time: 197812 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
   TPC-DS sf100 test result on commit 028fd7c377d0e3bd155f16bf23a861da82ba489e, data reload: false
   
   query1	1229	1037	999	999
   query2	6231	2090	2052	2052
   query3	11493	4751	4721	4721
   query4	33891	23883	23788	23788
   query5	4888	474	465	465
   query6	272	183	188	183
   query7	4003	291	301	291
   query8	298	243	227	227
   query9	9651	2735	2716	2716
   query10	514	250	260	250
   query11	18225	15134	15201	15134
   query12	151	99	99	99
   query13	1576	423	395	395
   query14	8975	7171	7399	7171
   query15	261	178	185	178
   query16	8046	479	478	478
   query17	1529	570	551	551
   query18	2113	293	285	285
   query19	345	150	157	150
   query20	131	117	116	116
   query21	202	109	107	107
   query22	4703	4400	4366	4366
   query23	35046	34244	34249	34244
   query24	11055	2781	2813	2781
   query25	613	376	403	376
   query26	1186	149	157	149
   query27	2310	280	282	280
   query28	7585	2441	2443	2441
   query29	819	396	389	389
   query30	250	162	157	157
   query31	993	777	798	777
   query32	90	51	52	51
   query33	744	258	261	258
   query34	939	502	509	502
   query35	1051	912	889	889
   query36	1108	957	942	942
   query37	131	67	71	67
   query38	4504	4293	4347	4293
   query39	1506	1441	1403	1403
   query40	199	95	96	95
   query41	45	43	42	42
   query42	113	92	102	92
   query43	511	491	485	485
   query44	1275	798	808	798
   query45	185	164	167	164
   query46	1133	695	696	695
   query47	1930	1828	1840	1828
   query48	422	315	318	315
   query49	880	384	384	384
   query50	805	387	393	387
   query51	7144	6987	6988	6987
   query52	96	87	86	86
   query53	248	176	178	176
   query54	1094	394	404	394
   query55	76	73	75	73
   query56	254	244	243	243
   query57	1310	1142	1128	1128
   query58	209	195	203	195
   query59	3126	2906	3083	2906
   query60	287	242	244	242
   query61	102	97	103	97
   query62	836	671	680	671
   query63	218	192	188	188
   query64	3984	653	589	589
   query65	3283	3223	3250	3223
   query66	804	296	298	296
   query67	16056	15958	15789	15789
   query68	3107	598	572	572
   query69	406	261	254	254
   query70	1216	1184	1161	1161
   query71	316	262	256	256
   query72	6052	4120	4079	4079
   query73	763	360	364	360
   query74	9625	9128	8981	8981
   query75	3435	2688	2692	2688
   query76	1779	990	967	967
   query77	423	282	279	279
   query78	10402	9682	9573	9573
   query79	1448	601	591	591
   query80	1103	447	438	438
   query81	561	243	241	241
   query82	1032	119	116	116
   query83	242	143	143	143
   query84	242	75	78	75
   query85	1324	353	342	342
   query86	391	310	301	301
   query87	4863	4769	4785	4769
   query88	3530	2231	2199	2199
   query89	419	292	293	292
   query90	2008	185	190	185
   query91	152	147	105	105
   query92	58	50	49	49
   query93	1356	553	540	540
   query94	953	295	273	273
   query95	349	245	247	245
   query96	613	281	295	281
   query97	2881	2686	2745	2686
   query98	204	191	207	191
   query99	1557	1291	1293	1291
   Total cold run time: 298092 ms
   Total hot run time: 197812 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "starocean999 (via GitHub)" <gi...@apache.org>.
starocean999 commented on code in PR #41913:
URL: https://github.com/apache/doris/pull/41913#discussion_r1804320495


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/SetSessionVarOp.java:
##########
@@ -0,0 +1,143 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.trees.plans.commands.info;
+
+import org.apache.doris.analysis.Expr;
+import org.apache.doris.analysis.SetType;
+import org.apache.doris.analysis.SetVar;
+import org.apache.doris.catalog.Env;
+import org.apache.doris.common.ErrorCode;
+import org.apache.doris.common.ErrorReport;
+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.nereids.CascadesContext;
+import org.apache.doris.nereids.exceptions.AnalysisException;
+import org.apache.doris.nereids.glue.translator.ExpressionTranslator;
+import org.apache.doris.nereids.glue.translator.PlanTranslatorContext;
+import org.apache.doris.nereids.properties.PhysicalProperties;
+import org.apache.doris.nereids.trees.expressions.Expression;
+import org.apache.doris.nereids.trees.expressions.literal.Literal;
+import org.apache.doris.nereids.trees.expressions.literal.StringLiteral;
+import org.apache.doris.nereids.trees.plans.logical.LogicalEmptyRelation;
+import org.apache.doris.nereids.util.ExpressionUtils;
+import org.apache.doris.qe.ConnectContext;
+import org.apache.doris.qe.GlobalVariable;
+import org.apache.doris.qe.SessionVariable;
+import org.apache.doris.qe.VariableMgr;
+import org.apache.doris.system.HeartbeatFlags;
+
+import java.util.ArrayList;
+
+/**
+ * SetSessionVarOp
+ */
+public class SetSessionVarOp extends SetVarOp {
+    private String name;
+    private final Expression expression;
+    private Literal value;
+
+    /** constructor*/
+    public SetSessionVarOp(SetType type, String name, Expression expression) {
+        super(type);
+        this.name = name;
+        this.expression = expression;
+    }
+
+    @Override
+    public void validate(ConnectContext ctx) throws UserException {
+        value = ExpressionUtils.analyzeAndFoldToLiteral(ctx, expression);
+        if (value.isNullLiteral()) {
+            return;
+        }
+
+        if (getType() == SetType.GLOBAL) {
+            if (!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(), PrivPredicate.ADMIN)) {
+                ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR, "ADMIN");
+            }
+        }
+
+        if (name.equalsIgnoreCase(GlobalVariable.DEFAULT_ROWSET_TYPE)) {
+            if (value != null && !HeartbeatFlags.isValidRowsetType(value.getStringValue())) {
+                throw new AnalysisException("Invalid rowset type, now we support {alpha, beta}.");
+            }
+        }
+
+        if (name.equalsIgnoreCase(SessionVariable.PREFER_JOIN_METHOD)) {
+            String val = value.getStringValue();
+            if (!val.equalsIgnoreCase("broadcast") && !val.equalsIgnoreCase("shuffle")) {
+                ErrorReport.reportAnalysisException(ErrorCode.ERR_WRONG_VALUE_FOR_VAR,
+                        SessionVariable.PREFER_JOIN_METHOD, val);
+            }
+        }
+
+        // Check variable time_zone value is valid
+        if (name.equalsIgnoreCase(SessionVariable.TIME_ZONE)) {
+            this.value = new StringLiteral(TimeUtils.checkTimeZoneValidAndStandardize(value.getStringValue()));
+        }
+
+        if (name.equalsIgnoreCase(SessionVariable.EXEC_MEM_LIMIT)
+                || name.equalsIgnoreCase(SessionVariable.SCAN_QUEUE_MEM_LIMIT)) {
+            this.value = new StringLiteral(Long.toString(ParseUtil.analyzeDataVolume(value.getStringValue())));
+        }
+
+        if (name.equalsIgnoreCase(SessionVariable.FILE_SPLIT_SIZE)) {
+            try {
+                this.value = new StringLiteral(
+                        Long.toString(ParseUtil.analyzeDataVolume(value.getStringValue())));
+            } catch (Throwable t) {
+                // The way of handling file_split_size should be same as exec_mem_limit or scan_queue_mem_limit.
+                // But ParseUtil.analyzeDataVolume() does not accept 0 as a valid value.
+                // So for compatibility, we set origin value to file_split_size
+                // when the value is 0 or other invalid value.
+                this.value = new StringLiteral(value.getStringValue());
+            }
+        }
+
+        if (name.equalsIgnoreCase("is_report_success")) {
+            name = SessionVariable.ENABLE_PROFILE;
+        }
+    }
+
+    public void run(ConnectContext ctx) throws Exception {
+        VariableMgr.setVar(ctx.getSessionVariable(), translateToLegacyVar(ctx));
+    }
+
+    @Override
+    public String toSql() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getType().toSql());
+        sb.append(" ").append(name).append(" = ").append(value.toSql());
+        return sb.toString();
+    }
+
+    public void forwardToMaster(ConnectContext ctx) throws Exception {
+        setType(SetType.SESSION);
+        VariableMgr.setVarForNonMasterFE(ctx.getSessionVariable(), translateToLegacyVar(ctx));
+    }
+
+    private SetVar translateToLegacyVar(ConnectContext ctx) {

Review Comment:
   todo remove it in next pr



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "starocean999 (via GitHub)" <gi...@apache.org>.
starocean999 commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2437378000

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2440428038

   
   <details>
   <summary>TPC-H: <b>Total hot run time: 41702 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
   Tpch sf100 test result on commit df9aad3b76721d6c55947a78c81ff10219534d30, data reload: false
   
   ------ Round 1 ----------------------------------
   q1	17563	7440	7310	7310
   q2	2016	281	279	279
   q3	12157	1098	1162	1098
   q4	10578	885	841	841
   q5	7759	3129	3107	3107
   q6	235	149	144	144
   q7	1040	616	613	613
   q8	9365	1971	2044	1971
   q9	6624	6501	6431	6431
   q10	7051	2443	2427	2427
   q11	442	249	248	248
   q12	412	223	217	217
   q13	17789	3014	3037	3014
   q14	249	211	219	211
   q15	575	506	525	506
   q16	683	592	583	583
   q17	994	620	521	521
   q18	7297	6813	6756	6756
   q19	1335	1041	1018	1018
   q20	480	190	182	182
   q21	4012	3353	3225	3225
   q22	1108	1000	1012	1000
   Total cold run time: 109764 ms
   Total hot run time: 41702 ms
   
   ----- Round 2, with runtime_filter_mode=off -----
   q1	7306	7265	7253	7253
   q2	330	239	243	239
   q3	3088	3012	3030	3012
   q4	2090	1881	1837	1837
   q5	5773	5861	5809	5809
   q6	226	144	140	140
   q7	2234	1822	1815	1815
   q8	3417	3473	3534	3473
   q9	8930	8976	9026	8976
   q10	3574	3587	3576	3576
   q11	602	479	504	479
   q12	841	632	665	632
   q13	11154	3273	3264	3264
   q14	315	277	275	275
   q15	577	527	521	521
   q16	715	651	646	646
   q17	1879	1613	1639	1613
   q18	8386	7785	7687	7687
   q19	1721	1409	1618	1409
   q20	2094	1889	1881	1881
   q21	5559	5563	5391	5391
   q22	1169	1051	1047	1047
   Total cold run time: 71980 ms
   Total hot run time: 60975 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "starocean999 (via GitHub)" <gi...@apache.org>.
starocean999 commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2440315595

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2440441050

   
   <details>
   <summary>TPC-DS: <b>Total hot run time: 192486 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
   TPC-DS sf100 test result on commit df9aad3b76721d6c55947a78c81ff10219534d30, data reload: false
   
   query1	824	397	405	397
   query2	6260	2095	2149	2095
   query3	8675	196	198	196
   query4	33987	23706	23580	23580
   query5	4748	476	456	456
   query6	275	171	175	171
   query7	4195	296	292	292
   query8	309	231	229	229
   query9	9378	2723	2715	2715
   query10	482	246	245	245
   query11	18161	15265	15169	15169
   query12	149	101	102	101
   query13	1551	410	410	410
   query14	10107	7032	7570	7032
   query15	250	173	181	173
   query16	8014	532	479	479
   query17	1467	596	570	570
   query18	2019	311	311	311
   query19	280	155	173	155
   query20	128	114	113	113
   query21	205	108	110	108
   query22	5019	4595	4483	4483
   query23	34607	34066	34031	34031
   query24	11683	2801	2905	2801
   query25	652	402	398	398
   query26	1638	162	170	162
   query27	2616	279	287	279
   query28	7696	2431	2424	2424
   query29	994	439	426	426
   query30	255	156	162	156
   query31	1012	794	834	794
   query32	95	56	58	56
   query33	779	279	268	268
   query34	970	509	545	509
   query35	1032	876	901	876
   query36	1119	969	953	953
   query37	193	78	75	75
   query38	4418	4157	4209	4157
   query39	1468	1461	1413	1413
   query40	257	103	101	101
   query41	47	46	48	46
   query42	115	104	104	104
   query43	562	513	503	503
   query44	1306	826	808	808
   query45	185	164	164	164
   query46	1139	719	729	719
   query47	1921	1814	1813	1813
   query48	439	322	327	322
   query49	1031	422	417	417
   query50	835	398	412	398
   query51	7064	6944	6986	6944
   query52	97	88	92	88
   query53	264	184	182	182
   query54	1293	409	408	408
   query55	79	77	79	77
   query56	276	250	252	250
   query57	1340	1167	1129	1129
   query58	234	216	217	216
   query59	3237	3082	2995	2995
   query60	283	255	248	248
   query61	102	98	104	98
   query62	840	653	663	653
   query63	214	189	192	189
   query64	4952	617	607	607
   query65	3314	3240	3226	3226
   query66	1321	303	306	303
   query67	15916	15914	15936	15914
   query68	4663	571	556	556
   query69	436	268	255	255
   query70	1260	1171	1111	1111
   query71	387	267	250	250
   query72	6092	4188	4018	4018
   query73	780	364	364	364
   query74	10342	9127	9037	9037
   query75	3445	2697	2696	2696
   query76	2819	1015	977	977
   query77	409	278	280	278
   query78	10637	9539	9485	9485
   query79	1373	596	598	596
   query80	936	446	446	446
   query81	574	237	245	237
   query82	701	114	114	114
   query83	245	140	136	136
   query84	220	69	71	69
   query85	1338	305	283	283
   query86	374	305	279	279
   query87	4840	4743	4823	4743
   query88	3250	2239	2187	2187
   query89	404	294	294	294
   query90	1980	187	190	187
   query91	137	101	100	100
   query92	61	50	50	50
   query93	1070	551	537	537
   query94	878	316	299	299
   query95	350	252	251	251
   query96	611	285	283	283
   query97	2925	2695	2744	2695
   query98	210	201	198	198
   query99	1549	1295	1316	1295
   Total cold run time: 301669 ms
   Total hot run time: 192486 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2437123865

   
   <details>
   <summary>ClickBench: <b>Total hot run time: 32.9 s</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
   ClickBench test result on commit 963a879b7a168556fd3e0536aa889c010c8a4245, data reload: false
   
   query1	0.03	0.03	0.03
   query2	0.06	0.03	0.03
   query3	0.22	0.07	0.06
   query4	1.64	0.11	0.10
   query5	0.42	0.40	0.38
   query6	1.16	0.65	0.65
   query7	0.02	0.01	0.01
   query8	0.04	0.03	0.03
   query9	0.57	0.50	0.49
   query10	0.56	0.55	0.53
   query11	0.14	0.11	0.10
   query12	0.15	0.11	0.11
   query13	0.62	0.61	0.60
   query14	2.74	2.74	2.76
   query15	0.90	0.84	0.83
   query16	0.38	0.38	0.39
   query17	1.06	1.06	1.03
   query18	0.24	0.22	0.23
   query19	1.90	1.88	1.96
   query20	0.02	0.02	0.01
   query21	15.38	0.59	0.58
   query22	2.66	2.67	1.75
   query23	16.95	1.04	0.85
   query24	2.52	1.86	1.30
   query25	0.25	0.09	0.11
   query26	0.55	0.14	0.14
   query27	0.04	0.04	0.04
   query28	10.26	1.11	1.08
   query29	12.56	3.29	3.30
   query30	0.24	0.07	0.06
   query31	2.88	0.39	0.38
   query32	3.28	0.46	0.46
   query33	3.00	3.03	2.99
   query34	16.93	4.47	4.42
   query35	4.52	4.50	4.48
   query36	0.66	0.52	0.48
   query37	0.09	0.06	0.06
   query38	0.04	0.04	0.03
   query39	0.03	0.02	0.02
   query40	0.15	0.13	0.12
   query41	0.07	0.02	0.02
   query42	0.04	0.02	0.02
   query43	0.04	0.03	0.03
   Total cold run time: 106.01 s
   Total hot run time: 32.9 s
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2445987643

   PR approved by anyone and no changes requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2422016339

   
   <details>
   <summary>TPC-H: <b>Total hot run time: 40993 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
   Tpch sf100 test result on commit 45e4fc2e3327fb9fd9d3640f975d672d13109104, data reload: false
   
   ------ Round 1 ----------------------------------
   q1	17564	7393	7252	7252
   q2	2019	284	287	284
   q3	12175	1041	1160	1041
   q4	10570	850	781	781
   q5	7752	3082	3054	3054
   q6	234	151	153	151
   q7	1009	611	589	589
   q8	9360	1897	1921	1897
   q9	6516	6469	6335	6335
   q10	7073	2434	2426	2426
   q11	443	239	246	239
   q12	409	216	217	216
   q13	17768	3009	2974	2974
   q14	259	222	231	222
   q15	575	527	531	527
   q16	661	581	578	578
   q17	963	476	499	476
   q18	7203	6743	6759	6743
   q19	1351	945	937	937
   q20	460	182	186	182
   q21	3933	3179	3113	3113
   q22	1098	1000	976	976
   Total cold run time: 109395 ms
   Total hot run time: 40993 ms
   
   ----- Round 2, with runtime_filter_mode=off -----
   q1	7259	7280	7247	7247
   q2	320	221	234	221
   q3	3036	2951	2940	2940
   q4	2085	1810	1792	1792
   q5	5746	5761	5797	5761
   q6	241	151	149	149
   q7	2259	1856	1801	1801
   q8	3354	3531	3421	3421
   q9	8989	8915	8925	8915
   q10	3589	3537	3527	3527
   q11	588	481	482	481
   q12	834	636	626	626
   q13	9950	3218	3241	3218
   q14	306	283	269	269
   q15	578	523	533	523
   q16	684	665	643	643
   q17	1816	1614	1607	1607
   q18	8254	7910	7642	7642
   q19	1714	1415	1474	1415
   q20	2115	1863	1863	1863
   q21	5503	5508	5336	5336
   q22	1152	1079	1038	1038
   Total cold run time: 70372 ms
   Total hot run time: 60435 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41913:
URL: https://github.com/apache/doris/pull/41913#issuecomment-2416567338

   
   <details>
   <summary>TPC-DS: <b>Total hot run time: 192353 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
   TPC-DS sf100 test result on commit 879c0e2bab46b0dd2ae3dbd9ec12409304770be0, data reload: false
   
   query1	933	385	399	385
   query2	6234	2040	1999	1999
   query3	8703	196	206	196
   query4	33855	23711	23516	23516
   query5	3494	447	456	447
   query6	257	165	169	165
   query7	4187	292	286	286
   query8	283	223	228	223
   query9	9370	2693	2710	2693
   query10	474	269	261	261
   query11	17863	15309	15434	15309
   query12	150	103	100	100
   query13	1567	429	409	409
   query14	9478	7379	7434	7379
   query15	255	176	178	176
   query16	8020	469	467	467
   query17	1611	624	599	599
   query18	2157	306	308	306
   query19	346	166	159	159
   query20	120	115	111	111
   query21	218	111	109	109
   query22	4719	4563	4579	4563
   query23	35906	34537	34257	34257
   query24	10778	2700	2747	2700
   query25	531	406	399	399
   query26	719	172	158	158
   query27	2242	285	293	285
   query28	7441	2405	2406	2405
   query29	663	431	418	418
   query30	261	154	155	154
   query31	1069	824	806	806
   query32	103	55	54	54
   query33	771	322	304	304
   query34	913	500	510	500
   query35	925	755	746	746
   query36	1102	919	953	919
   query37	146	103	93	93
   query38	3982	3900	3917	3900
   query39	1500	1435	1438	1435
   query40	202	98	97	97
   query41	48	45	47	45
   query42	124	103	104	103
   query43	527	479	473	473
   query44	1295	818	809	809
   query45	198	166	166	166
   query46	1130	699	700	699
   query47	1930	1863	1789	1789
   query48	417	329	321	321
   query49	965	428	434	428
   query50	834	411	385	385
   query51	7140	6968	7011	6968
   query52	100	90	90	90
   query53	264	182	184	182
   query54	1241	430	430	430
   query55	82	75	77	75
   query56	291	278	263	263
   query57	1282	1123	1155	1123
   query58	235	223	232	223
   query59	3320	2906	3110	2906
   query60	290	264	268	264
   query61	102	99	117	99
   query62	835	656	670	656
   query63	219	185	182	182
   query64	3894	640	607	607
   query65	3304	3189	3234	3189
   query66	828	297	300	297
   query67	16034	15744	15736	15736
   query68	4693	571	567	567
   query69	476	293	290	290
   query70	1171	1142	1116	1116
   query71	366	275	287	275
   query72	7097	4001	3940	3940
   query73	798	362	363	362
   query74	10223	9041	9153	9041
   query75	3426	2659	2653	2653
   query76	2885	954	921	921
   query77	633	299	299	299
   query78	10544	9707	9589	9589
   query79	2108	605	585	585
   query80	1061	443	449	443
   query81	579	237	244	237
   query82	733	140	144	140
   query83	296	138	132	132
   query84	280	67	71	67
   query85	1121	297	282	282
   query86	326	288	308	288
   query87	4470	4429	4387	4387
   query88	4108	2212	2183	2183
   query89	410	286	276	276
   query90	2098	195	186	186
   query91	133	99	102	99
   query92	64	47	47	47
   query93	1189	527	535	527
   query94	882	276	291	276
   query95	347	243	245	243
   query96	614	284	280	280
   query97	3295	3131	3135	3131
   query98	216	201	192	192
   query99	1575	1340	1303	1303
   Total cold run time: 298694 ms
   Total hot run time: 192353 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](nereids)support set command [doris]

Posted by "starocean999 (via GitHub)" <gi...@apache.org>.
starocean999 commented on code in PR #41913:
URL: https://github.com/apache/doris/pull/41913#discussion_r1804321266


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/Command.java:
##########
@@ -116,4 +116,14 @@ public String treeString() {
     public Plan withGroupExpression(Optional<GroupExpression> groupExpression) {
         throw new RuntimeException("Command do not implement withGroupExpression");
     }
+
+    public String toSql() {
+        return "";
+    }
+
+    public boolean needAuditEncryption() {
+        return false;
+    }
+
+    public void forwardToMaster(ConnectContext ctx) throws Exception {}

Review Comment:
   change name to afterForwardToMaster



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org