This is an automated email from the ASF dual-hosted git repository.

starocean999 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 5cef9c7f867 [Chore](nereids) remove SetStmt (#56080)
5cef9c7f867 is described below

commit 5cef9c7f867980a368e567575e079079a14d6514
Author: csding <[email protected]>
AuthorDate: Wed Sep 17 14:26:19 2025 +0800

    [Chore](nereids) remove SetStmt (#56080)
---
 .../org/apache/doris/analysis/SetLdapPassVar.java  |  62 ----------
 .../org/apache/doris/analysis/SetNamesVar.java     |  73 ------------
 .../java/org/apache/doris/analysis/SetPassVar.java | 100 ----------------
 .../java/org/apache/doris/analysis/SetStmt.java    | 108 -----------------
 .../org/apache/doris/analysis/SetTransaction.java  |  28 -----
 .../apache/doris/analysis/SetUserDefinedVar.java   |  30 -----
 .../apache/doris/analysis/SetUserPropertyVar.java  | 130 ---------------------
 .../org/apache/doris/mysql/privilege/Auth.java     |  15 ---
 .../apache/doris/mysql/privilege/UserProperty.java |   4 +-
 .../plans/commands/ShowUserPropertyCommand.java    |   6 +-
 .../plans/commands/info/SetUserPropertyVarOp.java  |   2 +
 .../java/org/apache/doris/qe/ConnectContext.java   |   5 -
 .../main/java/org/apache/doris/qe/SetExecutor.java |  70 -----------
 .../java/org/apache/doris/qe/StmtExecutor.java     |   8 --
 .../WorkloadActionSetSessionVar.java               |  14 +--
 .../org/apache/doris/analysis/AccessTestUtil.java  |   2 +-
 .../doris/mysql/privilege/SetPasswordTest.java     |  29 +++--
 .../java/org/apache/doris/qe/SetExecutorTest.java  |  94 ---------------
 18 files changed, 25 insertions(+), 755 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetLdapPassVar.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/SetLdapPassVar.java
deleted file mode 100644
index 4080ea0b895..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetLdapPassVar.java
+++ /dev/null
@@ -1,62 +0,0 @@
-// 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.analysis;
-
-import org.apache.doris.catalog.Env;
-import org.apache.doris.common.AnalysisException;
-import org.apache.doris.common.ErrorCode;
-import org.apache.doris.common.ErrorReport;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-
-public class SetLdapPassVar extends SetVar {
-    private final PassVar passVar;
-
-    public SetLdapPassVar(PassVar passVar) {
-        this.passVar = passVar;
-        this.varType = SetVarType.SET_LDAP_PASS_VAR;
-    }
-
-    public String getLdapPassword() {
-        return passVar.getText();
-    }
-
-    @Override
-    public void analyze() throws AnalysisException {
-        if 
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(), 
PrivPredicate.ADMIN)) {
-            
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
-                    PrivPredicate.ADMIN.getPrivs().toString());
-        }
-        if (!passVar.isPlain()) {
-            throw new AnalysisException("Only support set ldap password with 
plain text");
-        }
-        passVar.analyze();
-    }
-
-    @Override
-    public String toString() {
-        return toSql();
-    }
-
-    @Override
-    public String toSql() {
-        StringBuilder sb = new StringBuilder("SET LDAP_ADMIN_PASSWORD");
-        sb.append(" = '*XXX'");
-        return sb.toString();
-    }
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetNamesVar.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/SetNamesVar.java
deleted file mode 100644
index f1e72302e56..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetNamesVar.java
+++ /dev/null
@@ -1,73 +0,0 @@
-// 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.analysis;
-
-import org.apache.doris.common.AnalysisException;
-import org.apache.doris.common.ErrorCode;
-import org.apache.doris.common.ErrorReport;
-
-import com.google.common.base.Strings;
-
-// Now only support utf-8
-public class SetNamesVar extends SetVar {
-    private static final String DEFAULT_NAMES = "utf8";
-    private String charset;
-    private String collate;
-
-    public SetNamesVar(String charsetName) {
-        this(charsetName, null);
-        this.varType = SetVarType.SET_NAMES_VAR;
-    }
-
-    public SetNamesVar(String charsetName, String collate) {
-        this.charset = charsetName;
-        this.collate = collate;
-    }
-
-    public String getCharset() {
-        return charset;
-    }
-
-    @Override
-    public void analyze() throws AnalysisException {
-        if (Strings.isNullOrEmpty(charset)) {
-            charset = DEFAULT_NAMES;
-        } else {
-            charset = charset.toLowerCase();
-        }
-        // utf8-superset transform to utf8
-        if (charset.startsWith(DEFAULT_NAMES)) {
-            charset = DEFAULT_NAMES;
-        }
-
-        if (!charset.equalsIgnoreCase(DEFAULT_NAMES)) {
-            
ErrorReport.reportAnalysisException(ErrorCode.ERR_UNKNOWN_CHARACTER_SET, 
charset);
-        }
-    }
-
-    @Override
-    public String toSql() {
-        return "NAMES '" + charset + "' COLLATE "
-                + (Strings.isNullOrEmpty(collate) ? "DEFAULT" : "'" + 
collate.toLowerCase() + "'");
-    }
-
-    @Override
-    public String toString() {
-        return toSql();
-    }
-}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetPassVar.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/SetPassVar.java
deleted file mode 100644
index 45a8d16926b..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetPassVar.java
+++ /dev/null
@@ -1,100 +0,0 @@
-// 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.analysis;
-
-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.mysql.privilege.Auth;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-
-public class SetPassVar extends SetVar {
-    private UserIdentity userIdent;
-    private PassVar passVar;
-
-    // The password in parameter is a hashed password.
-    public SetPassVar(UserIdentity userIdent, PassVar passVar) {
-        this.userIdent = userIdent;
-        this.passVar = passVar;
-        this.varType = SetVarType.SET_PASS_VAR;
-    }
-
-    public UserIdentity getUserIdent() {
-        return userIdent;
-    }
-
-    public byte[] getPassword() {
-        return passVar.getScrambled();
-    }
-
-    @Override
-    public void analyze() throws AnalysisException {
-        boolean isSelf = false;
-        ConnectContext ctx = ConnectContext.get();
-        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");
-        }
-
-        // 3. user has grant privs
-        if 
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(), 
PrivPredicate.GRANT)) {
-            
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR, 
"GRANT");
-        }
-    }
-
-    @Override
-    public String toString() {
-        return toSql();
-    }
-
-    @Override
-    public String toSql() {
-        StringBuilder sb = new StringBuilder("SET PASSWORD");
-        if (userIdent != null) {
-            sb.append(" FOR ").append(userIdent.toString());
-        }
-        sb.append(" = '*XXX'");
-        return sb.toString();
-    }
-}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/SetStmt.java
deleted file mode 100644
index fbc1b80edf3..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetStmt.java
+++ /dev/null
@@ -1,108 +0,0 @@
-// 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.analysis;
-
-import org.apache.doris.common.AnalysisException;
-import org.apache.doris.common.UserException;
-
-import java.util.List;
-
-// Set variables statement. Now only support simple string
-public class SetStmt extends StatementBase implements NotFallbackInParser {
-    // variables to modify
-    private final List<SetVar> setVars;
-
-    public SetStmt(List<SetVar> setVars) {
-        this.setVars = setVars;
-    }
-
-    public List<SetVar> getSetVars() {
-        return setVars;
-    }
-
-    // remove setvar of non-set-session-var,
-    // change type global to session avoid to write in non-master node.
-    public void modifySetVarsForExecute() {
-        setVars.removeIf(setVar -> setVar.getVarType() != 
SetVar.SetVarType.SET_SESSION_VAR);
-        for (SetVar var : setVars) {
-            if (var.getType() == SetType.GLOBAL) {
-                var.setType(SetType.SESSION);
-            }
-        }
-    }
-
-    @Override
-    public boolean needAuditEncryption() {
-        for (SetVar var : setVars) {
-            if (var instanceof SetPassVar) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public void analyze() throws UserException {
-        if (setVars == null || setVars.isEmpty()) {
-            throw new AnalysisException("Empty set statement.");
-        }
-        for (SetVar var : setVars) {
-            var.analyze();
-        }
-    }
-
-    @Override
-    public String toSql() {
-        StringBuilder sb = new StringBuilder();
-
-        sb.append("SET ");
-        int idx = 0;
-        for (SetVar var : setVars) {
-            if (idx != 0) {
-                sb.append(", ");
-            }
-            sb.append(var.toSql());
-            idx++;
-        }
-        return sb.toString();
-    }
-
-    @Override
-    public String toString() {
-        return toSql();
-    }
-
-    @Override
-    public StmtType stmtType() {
-        return StmtType.SET;
-    }
-
-    @Override
-    public RedirectStatus getRedirectStatus() {
-        if (setVars != null) {
-            for (SetVar var : setVars) {
-                if (var instanceof SetPassVar || var instanceof 
SetLdapPassVar) {
-                    return RedirectStatus.FORWARD_WITH_SYNC;
-                } else if (var.getType() == SetType.GLOBAL) {
-                    return RedirectStatus.FORWARD_WITH_SYNC;
-                }
-            }
-        }
-        return RedirectStatus.NO_FORWARD;
-    }
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetTransaction.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/SetTransaction.java
deleted file mode 100644
index 87b62db66ad..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetTransaction.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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.analysis;
-
-public class SetTransaction extends SetVar {
-    public SetTransaction() {
-        this.varType = SetVarType.SET_TRANSACTION;
-    }
-
-    @Override
-    public void analyze() {
-    }
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetUserDefinedVar.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/SetUserDefinedVar.java
deleted file mode 100644
index 2c4c6373ba9..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetUserDefinedVar.java
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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.analysis;
-
-import org.apache.doris.common.AnalysisException;
-
-public class SetUserDefinedVar extends SetVar {
-    public SetUserDefinedVar(String variable, Expr value) {
-        super(SetType.USER, variable, value, SetVarType.SET_USER_DEFINED_VAR);
-    }
-
-    @Override
-    public void analyze() throws AnalysisException  {
-    }
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetUserPropertyVar.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/SetUserPropertyVar.java
deleted file mode 100644
index 78868e5e668..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetUserPropertyVar.java
+++ /dev/null
@@ -1,130 +0,0 @@
-// 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.analysis;
-
-import org.apache.doris.catalog.Env;
-import org.apache.doris.cloud.system.CloudSystemInfoService;
-import org.apache.doris.common.AnalysisException;
-import org.apache.doris.common.Config;
-import org.apache.doris.common.ErrorCode;
-import org.apache.doris.common.ErrorReport;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.mysql.privilege.UserProperty;
-import org.apache.doris.qe.ConnectContext;
-
-import com.google.common.base.Strings;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class SetUserPropertyVar extends SetVar {
-    public static final String DOT_SEPARATOR = ".";
-
-    private final String key;
-    private final String value;
-
-    public SetUserPropertyVar(String key, String value) {
-        this.key = key;
-        this.value = value;
-        this.varType = SetVarType.SET_USER_PROPERTY_VAR;
-    }
-
-    public String getPropertyKey() {
-        return key;
-    }
-
-    public String getPropertyValue() {
-        return value;
-    }
-
-    public void analyze(boolean isSelf) throws AnalysisException {
-        if (Strings.isNullOrEmpty(key)) {
-            throw new AnalysisException("User property key is null");
-        }
-
-        if (value == null) {
-            throw new AnalysisException("User property value is null");
-        }
-
-        checkAccess(isSelf);
-    }
-
-    private void checkAccess(boolean isSelf) throws AnalysisException {
-        for (Pattern advPattern : UserProperty.ADVANCED_PROPERTIES) {
-            Matcher matcher = advPattern.matcher(key);
-            if (matcher.find()) {
-                if (!Env.getCurrentEnv().getAccessManager()
-                        .checkGlobalPriv(ConnectContext.get(), 
PrivPredicate.ADMIN)) {
-                    
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR, 
"ADMIN");
-                }
-                return;
-            }
-        }
-
-        for (Pattern commPattern : UserProperty.COMMON_PROPERTIES) {
-            Matcher matcher = commPattern.matcher(key);
-            if (matcher.find()) {
-                if (!isSelf && 
!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(),
-                        PrivPredicate.ADMIN)) {
-                    
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
-                            "GRANT");
-                }
-                if (Config.isCloudMode()) {
-                    // check value, clusterName is valid.
-                    if (key.equals(UserProperty.DEFAULT_CLOUD_CLUSTER)
-                            && !Strings.isNullOrEmpty(value)
-                            && !((CloudSystemInfoService) 
Env.getCurrentSystemInfo())
-                                    .getCloudClusterNames().contains(value)) {
-                        
ErrorReport.reportAnalysisException(ErrorCode.ERR_CLOUD_CLUSTER_ERROR, value);
-                    }
-
-                    if (key.equals(UserProperty.DEFAULT_COMPUTE_GROUP)
-                            && !Strings.isNullOrEmpty(value)
-                            && !((CloudSystemInfoService) 
Env.getCurrentSystemInfo())
-                                    .getCloudClusterNames().contains(value)) {
-                        
ErrorReport.reportAnalysisException(ErrorCode.ERR_CLOUD_CLUSTER_ERROR, value);
-                    }
-                }
-                return;
-            }
-        }
-
-        throw new AnalysisException("Unknown property key: " + key);
-    }
-
-    @Override
-    public String toString() {
-        return toSql();
-    }
-
-    @Override
-    public String toSql() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("'");
-        sb.append(key);
-        sb.append("' = ");
-        if (value != null) {
-            sb.append("'");
-            sb.append(value);
-            sb.append("'");
-        } else {
-            sb.append("NULL");
-        }
-        return sb.toString();
-    }
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/Auth.java 
b/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/Auth.java
index 29d6c4f6634..83a1f79b0ff 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/Auth.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/Auth.java
@@ -21,8 +21,6 @@ import org.apache.doris.alter.AlterUserOpType;
 import org.apache.doris.analysis.PasswordOptions;
 import org.apache.doris.analysis.ResourcePattern;
 import org.apache.doris.analysis.ResourceTypeEnum;
-import org.apache.doris.analysis.SetLdapPassVar;
-import org.apache.doris.analysis.SetPassVar;
 import org.apache.doris.analysis.TablePattern;
 import org.apache.doris.analysis.UserIdentity;
 import org.apache.doris.analysis.WorkloadGroupPattern;
@@ -962,12 +960,6 @@ public class Auth implements Writable {
         }
     }
 
-    // set password
-    public void setPassword(SetPassVar stmt) throws DdlException {
-        setPasswordInternal(stmt.getUserIdent(), stmt.getPassword(), null, 
true /* err on non exist */,
-                false /* set by resolver */, false);
-    }
-
     public void setPassword(UserIdentity userIdentity, byte[] password) throws 
DdlException {
         setPasswordInternal(userIdentity, password, null, true /* err on non 
exist */,
                 false /* set by resolver */, false);
@@ -1009,13 +1001,6 @@ public class Auth implements Writable {
         LOG.info("finished to set password for {}. is replay: {}", userIdent, 
isReplay);
     }
 
-    // set ldap admin password.
-    public void setLdapPassword(SetLdapPassVar stmt) {
-        ldapInfo = new LdapInfo(stmt.getLdapPassword());
-        Env.getCurrentEnv().getEditLog().logSetLdapPassword(ldapInfo);
-        LOG.info("finished to set ldap password.");
-    }
-
     public void setLdapPassword(String ldapPassword) {
         ldapInfo = new LdapInfo(ldapPassword);
         Env.getCurrentEnv().getEditLog().logSetLdapPassword(ldapInfo);
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java 
b/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java
index 6a148d84a40..3d0de61a49b 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java
@@ -18,7 +18,6 @@
 package org.apache.doris.mysql.privilege;
 
 import org.apache.doris.analysis.ResourceTypeEnum;
-import org.apache.doris.analysis.SetUserPropertyVar;
 import org.apache.doris.analysis.UserIdentity;
 import org.apache.doris.catalog.Env;
 import org.apache.doris.cloud.qe.ComputeGroupException;
@@ -27,6 +26,7 @@ import org.apache.doris.common.DdlException;
 import org.apache.doris.common.Pair;
 import org.apache.doris.common.UserException;
 import org.apache.doris.datasource.CatalogIf;
+import org.apache.doris.nereids.trees.plans.commands.info.SetUserPropertyVarOp;
 import org.apache.doris.resource.Tag;
 
 import com.google.common.base.Joiner;
@@ -196,7 +196,7 @@ public class UserProperty {
             String key = entry.first;
             String value = entry.second;
 
-            String[] keyArr = key.split("\\" + 
SetUserPropertyVar.DOT_SEPARATOR);
+            String[] keyArr = key.split("\\" + 
SetUserPropertyVarOp.DOT_SEPARATOR);
             if (keyArr[0].equalsIgnoreCase(PROP_MAX_USER_CONNECTIONS)) {
                 // set property "max_user_connections" = "1000"
                 if (keyArr.length != 1) {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowUserPropertyCommand.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowUserPropertyCommand.java
index edc3f03f6f4..10f7429a561 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowUserPropertyCommand.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowUserPropertyCommand.java
@@ -17,7 +17,6 @@
 
 package org.apache.doris.nereids.trees.plans.commands;
 
-import org.apache.doris.analysis.SetUserPropertyVar;
 import org.apache.doris.catalog.Column;
 import org.apache.doris.catalog.Env;
 import org.apache.doris.catalog.ScalarType;
@@ -30,6 +29,7 @@ import org.apache.doris.common.PatternMatcherWrapper;
 import org.apache.doris.common.proc.UserPropertyProcNode;
 import org.apache.doris.mysql.privilege.PrivPredicate;
 import org.apache.doris.nereids.trees.plans.PlanType;
+import org.apache.doris.nereids.trees.plans.commands.info.SetUserPropertyVarOp;
 import org.apache.doris.nereids.trees.plans.visitor.PlanVisitor;
 import org.apache.doris.persist.gson.GsonUtils;
 import org.apache.doris.qe.ConnectContext;
@@ -110,7 +110,7 @@ public class ShowUserPropertyCommand extends ShowCommand {
         PatternMatcher matcher = 
PatternMatcherWrapper.createMysqlPattern(pattern,
                 CaseSensibility.USER.getCaseSensibility());
         for (List<String> row : rows) {
-            String key = row.get(0).split("\\" + 
SetUserPropertyVar.DOT_SEPARATOR)[0];
+            String key = row.get(0).split("\\" + 
SetUserPropertyVarOp.DOT_SEPARATOR)[0];
             if (matcher.match(key)) {
                 result.add(row);
             }
@@ -143,7 +143,7 @@ public class ShowUserPropertyCommand extends ShowCommand {
         }
 
         for (List<String> row : userProperties) {
-            String key = row.get(0).split("\\" + 
SetUserPropertyVar.DOT_SEPARATOR)[0];
+            String key = row.get(0).split("\\" + 
SetUserPropertyVarOp.DOT_SEPARATOR)[0];
             if (matcher == null || matcher.match(key)) {
                 result.put(row.get(0), row.get(1));
             }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/SetUserPropertyVarOp.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/SetUserPropertyVarOp.java
index 12db9218a16..bfbb42458e2 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/SetUserPropertyVarOp.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/SetUserPropertyVarOp.java
@@ -37,6 +37,8 @@ import java.util.regex.Pattern;
  * SetUserPropertyVarOp
  */
 public class SetUserPropertyVarOp {
+    public static final String DOT_SEPARATOR = ".";
+
     private final String user;
     private final String key;
     private final String value;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java
index 4d63ef7404f..fe9a58de2af 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java
@@ -25,7 +25,6 @@ import org.apache.doris.analysis.LiteralExpr;
 import org.apache.doris.analysis.NullLiteral;
 import org.apache.doris.analysis.RedirectStatus;
 import org.apache.doris.analysis.ResourceTypeEnum;
-import org.apache.doris.analysis.SetVar;
 import org.apache.doris.analysis.StringLiteral;
 import org.apache.doris.analysis.UserIdentity;
 import org.apache.doris.analysis.VariableExpr;
@@ -560,10 +559,6 @@ public class ConnectContext {
         defaultCatalog = env.getInternalCatalog().getName();
     }
 
-    public void setUserVar(SetVar setVar) {
-        userVars.put(setVar.getVariable().toLowerCase(), setVar.getResult());
-    }
-
     public void setUserVar(String name, LiteralExpr value) {
         userVars.put(name.toLowerCase(), value);
     }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SetExecutor.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/SetExecutor.java
deleted file mode 100644
index 673f01562ce..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/SetExecutor.java
+++ /dev/null
@@ -1,70 +0,0 @@
-// 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.qe;
-
-import org.apache.doris.analysis.SetLdapPassVar;
-import org.apache.doris.analysis.SetNamesVar;
-import org.apache.doris.analysis.SetPassVar;
-import org.apache.doris.analysis.SetStmt;
-import org.apache.doris.analysis.SetTransaction;
-import org.apache.doris.analysis.SetUserDefinedVar;
-import org.apache.doris.analysis.SetVar;
-import org.apache.doris.common.DdlException;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-// Set executor
-public class SetExecutor {
-    private static final Logger LOG = LogManager.getLogger(SetExecutor.class);
-
-    private ConnectContext ctx;
-    private SetStmt stmt;
-
-    public SetExecutor(ConnectContext ctx, SetStmt stmt) {
-        this.ctx = ctx;
-        this.stmt = stmt;
-    }
-
-    private void setVariable(SetVar var) throws DdlException {
-        if (var instanceof SetPassVar) {
-            // Set password
-            SetPassVar setPassVar = (SetPassVar) var;
-            ctx.getEnv().getAuth().setPassword(setPassVar);
-        } else if (var instanceof SetLdapPassVar) {
-            SetLdapPassVar setLdapPassVar = (SetLdapPassVar) var;
-            ctx.getEnv().getAuth().setLdapPassword(setLdapPassVar);
-        } else if (var instanceof SetNamesVar) {
-            // do nothing
-            return;
-        } else if (var instanceof SetTransaction) {
-            // do nothing
-            return;
-        } else if (var instanceof SetUserDefinedVar) {
-            ConnectContext.get().setUserVar(var);
-        } else {
-            VariableMgr.setVar(ctx.getSessionVariable(), var);
-        }
-    }
-
-    public void execute() throws DdlException {
-        for (SetVar var : stmt.getSetVars()) {
-            setVariable(var);
-        }
-    }
-}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
index f944157f856..713e5f7b172 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
@@ -22,8 +22,6 @@ import org.apache.doris.analysis.OutFileClause;
 import org.apache.doris.analysis.PlaceHolderExpr;
 import org.apache.doris.analysis.Queriable;
 import org.apache.doris.analysis.RedirectStatus;
-import org.apache.doris.analysis.SetStmt;
-import org.apache.doris.analysis.SetVar;
 import org.apache.doris.analysis.StatementBase;
 import org.apache.doris.analysis.StorageBackend;
 import org.apache.doris.analysis.StorageBackend.StorageType;
@@ -971,12 +969,6 @@ public class StmtExecutor {
                 Forward forward = (Forward) ((LogicalPlanAdapter) 
parsedStmt).getLogicalPlan();
                 forward.afterForwardToMaster(context);
             }
-        } else if (parsedStmt instanceof SetStmt) {
-            SetStmt setStmt = (SetStmt) parsedStmt;
-            setStmt.modifySetVarsForExecute();
-            for (SetVar var : setStmt.getSetVars()) {
-                VariableMgr.setVarForNonMasterFE(context.getSessionVariable(), 
var);
-            }
         }
     }
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/resource/workloadschedpolicy/WorkloadActionSetSessionVar.java
 
b/fe/fe-core/src/main/java/org/apache/doris/resource/workloadschedpolicy/WorkloadActionSetSessionVar.java
index 18ba64b3496..775fa91b995 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/resource/workloadschedpolicy/WorkloadActionSetSessionVar.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/resource/workloadschedpolicy/WorkloadActionSetSessionVar.java
@@ -17,19 +17,15 @@
 
 package org.apache.doris.resource.workloadschedpolicy;
 
-import org.apache.doris.analysis.SetStmt;
 import org.apache.doris.analysis.SetVar;
 import org.apache.doris.analysis.StringLiteral;
 import org.apache.doris.common.UserException;
-import org.apache.doris.qe.SetExecutor;
+import org.apache.doris.qe.VariableMgr;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
-import java.util.ArrayList;
-import java.util.List;
-
 public class WorkloadActionSetSessionVar implements WorkloadAction {
 
     private static final Logger LOG = 
LogManager.getLogger(WorkloadActionSetSessionVar.class);
@@ -45,12 +41,8 @@ public class WorkloadActionSetSessionVar implements 
WorkloadAction {
     @Override
     public void exec(WorkloadQueryInfo queryInfo) {
         try {
-            List<SetVar> list = new ArrayList<>();
-            SetVar sv = new SetVar(varName, new StringLiteral(varValue));
-            list.add(sv);
-            SetStmt setStmt = new SetStmt(list);
-            SetExecutor executor = new SetExecutor(queryInfo.context, setStmt);
-            executor.execute();
+            SetVar var = new SetVar(varName, new StringLiteral(varValue));
+            VariableMgr.setVar(queryInfo.context.getSessionVariable(), var);
         } catch (Throwable t) {
             LOG.error("error happens when exec {}", 
WorkloadActionType.SET_SESSION_VARIABLE, t);
         }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/analysis/AccessTestUtil.java 
b/fe/fe-core/src/test/java/org/apache/doris/analysis/AccessTestUtil.java
index d396447f5a6..a89c734086c 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/analysis/AccessTestUtil.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/analysis/AccessTestUtil.java
@@ -65,7 +65,7 @@ public class AccessTestUtil {
         try {
             new Expectations(auth) {
                 {
-                    auth.setPassword((SetPassVar) any);
+                    auth.setPassword((UserIdentity) any, (byte[]) any);
                     minTimes = 0;
                 }
             };
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/mysql/privilege/SetPasswordTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/mysql/privilege/SetPasswordTest.java
index 6bbaf8af88c..0505dc357dd 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/mysql/privilege/SetPasswordTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/mysql/privilege/SetPasswordTest.java
@@ -17,15 +17,16 @@
 
 package org.apache.doris.mysql.privilege;
 
-import org.apache.doris.analysis.SetPassVar;
 import org.apache.doris.analysis.UserDesc;
 import org.apache.doris.analysis.UserIdentity;
 import org.apache.doris.catalog.Env;
 import org.apache.doris.common.AnalysisException;
 import org.apache.doris.common.DdlException;
+import org.apache.doris.common.UserException;
 import org.apache.doris.mysql.MysqlPassword;
 import org.apache.doris.nereids.trees.plans.commands.CreateUserCommand;
 import org.apache.doris.nereids.trees.plans.commands.info.CreateUserInfo;
+import org.apache.doris.nereids.trees.plans.commands.info.SetPassVarOp;
 import org.apache.doris.persist.EditLog;
 import org.apache.doris.persist.PrivInfo;
 import org.apache.doris.qe.ConnectContext;
@@ -87,19 +88,19 @@ public class SetPasswordTest {
 
         UserIdentity user1 = new UserIdentity("cmy", "%");
         user1.setIsAnalyzed();
-        SetPassVar setPassVar = new SetPassVar(user1, null);
+        SetPassVarOp setPassVarOp = new SetPassVarOp(user1, null);
         try {
-            setPassVar.analyze();
-        } catch (AnalysisException e) {
+            setPassVarOp.validate(ctx);
+        } catch (UserException e) {
             e.printStackTrace();
             Assert.fail();
         }
 
         // set password without for
-        SetPassVar setPassVar2 = new SetPassVar(null, null);
+        SetPassVarOp setPassVarOp2 = new SetPassVarOp(null, null);
         try {
-            setPassVar2.analyze();
-        } catch (AnalysisException e) {
+            setPassVarOp2.validate(ctx);
+        } catch (UserException e) {
             e.printStackTrace();
             Assert.fail();
         }
@@ -116,10 +117,10 @@ public class SetPasswordTest {
         ctx.setThreadLocalInfo();
 
         // set password without for
-        SetPassVar setPassVar3 = new SetPassVar(null, null);
+        SetPassVarOp setPassVarOp3 = new SetPassVarOp(null, null);
         try {
-            setPassVar3.analyze();
-        } catch (AnalysisException e) {
+            setPassVarOp3.validate(ctx);
+        } catch (UserException e) {
             e.printStackTrace();
             Assert.fail();
         }
@@ -127,14 +128,12 @@ public class SetPasswordTest {
         // set password for cmy2@'192.168.1.1'
         UserIdentity user2 = new UserIdentity("cmy2", "192.168.1.1");
         user2.setIsAnalyzed();
-        SetPassVar setPassVar4 = new SetPassVar(user2, null);
+        SetPassVarOp setPassVarOp4 = new SetPassVarOp(user2, null);
         try {
-            setPassVar4.analyze();
-        } catch (AnalysisException e) {
+            setPassVarOp4.validate(ctx);
+        } catch (UserException e) {
             e.printStackTrace();
             Assert.fail();
         }
-
     }
-
 }
diff --git a/fe/fe-core/src/test/java/org/apache/doris/qe/SetExecutorTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/qe/SetExecutorTest.java
deleted file mode 100644
index fb341ba2956..00000000000
--- a/fe/fe-core/src/test/java/org/apache/doris/qe/SetExecutorTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-// 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.qe;
-
-import org.apache.doris.analysis.AccessTestUtil;
-import org.apache.doris.analysis.IntLiteral;
-import org.apache.doris.analysis.PassVar;
-import org.apache.doris.analysis.SetNamesVar;
-import org.apache.doris.analysis.SetPassVar;
-import org.apache.doris.analysis.SetStmt;
-import org.apache.doris.analysis.SetVar;
-import org.apache.doris.analysis.UserIdentity;
-import org.apache.doris.common.DdlException;
-import org.apache.doris.common.UserException;
-import org.apache.doris.mysql.privilege.AccessControllerManager;
-import org.apache.doris.mysql.privilege.Auth;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-
-import com.google.common.collect.Lists;
-import mockit.Expectations;
-import mockit.Mocked;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.List;
-
-public class SetExecutorTest {
-    private ConnectContext ctx;
-
-    @Mocked
-    private AccessControllerManager accessManager;
-    @Mocked
-    private Auth auth;
-
-    @Before
-    public void setUp() throws DdlException {
-        ctx = new ConnectContext();
-        ctx.setEnv(AccessTestUtil.fetchAdminCatalog());
-        ctx.setRemoteIP("192.168.1.1");
-        UserIdentity currentUser = new UserIdentity("root", "192.168.1.1");
-        currentUser.setIsAnalyzed();
-        ctx.setCurrentUserIdentity(currentUser);
-        ctx.setThreadLocalInfo();
-
-        new Expectations() {
-            {
-                accessManager.checkGlobalPriv((ConnectContext) any, 
(PrivPredicate) any);
-                minTimes = 0;
-                result = true;
-
-                accessManager.checkDbPriv((ConnectContext) any, anyString, 
anyString, (PrivPredicate) any);
-                minTimes = 0;
-                result = true;
-
-                accessManager.checkTblPriv((ConnectContext) any, anyString, 
anyString, anyString, (PrivPredicate) any);
-                minTimes = 0;
-                result = true;
-
-                auth.setPassword((SetPassVar) any);
-                minTimes = 0;
-            }
-        };
-    }
-
-    @Test
-    public void testNormal() throws UserException {
-        List<SetVar> vars = Lists.newArrayList();
-        vars.add(new SetPassVar(new UserIdentity("testUser", "%"),
-                new PassVar("*88EEBA7D913688E7278E2AD071FDB5E76D76D34B", 
false)));
-        vars.add(new SetNamesVar("utf8"));
-        vars.add(new SetVar("query_timeout", new IntLiteral(10L)));
-
-        SetStmt stmt = new SetStmt(vars);
-        stmt.analyze();
-        SetExecutor executor = new SetExecutor(ctx, stmt);
-
-        executor.execute();
-    }
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to