Copilot commented on code in PR #51122:
URL: https://github.com/apache/doris/pull/51122#discussion_r2101535385


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/CreatePolicyStmt.java:
##########
@@ -39,119 +29,28 @@
  */
 public class CreatePolicyStmt extends DdlStmt implements NotFallbackInParser {
 
-    @Getter
-    private final PolicyTypeEnum type;
-
-    @Getter
-    private final boolean ifNotExists;
-
-    @Getter
-    private final String policyName;
-
-    @Getter
-    private TableName tableName = null;
-
-    @Getter
-    private FilterType filterType = null;
-
-    @Getter
-    private UserIdentity user = null;
-
-    @Getter
-    private String roleName = null;
-
-    @Getter
-    private Expr wherePredicate;
-
-    @Getter
-    private Map<String, String> properties;
-
     /**
      * Use for cup.
      **/
     public CreatePolicyStmt(PolicyTypeEnum type, boolean ifNotExists, String 
policyName, TableName tableName,
             String filterType, UserIdentity user, String roleName, Expr 
wherePredicate) {
-        this.type = type;
-        this.ifNotExists = ifNotExists;
-        this.policyName = policyName;
-        this.tableName = tableName;
-        this.filterType = FilterType.of(filterType);
-        this.user = user;
-        this.roleName = roleName;
-        this.wherePredicate = wherePredicate;
     }
 
     /**
      * Use for cup.
      */
     public CreatePolicyStmt(PolicyTypeEnum type, boolean ifNotExists, String 
policyName,
             Map<String, String> properties) {
-        this.type = type;
-        this.ifNotExists = ifNotExists;
-        this.policyName = policyName;
-        this.properties = properties;
     }
 
     @Override
     public void analyze(Analyzer analyzer) throws UserException {
-        super.analyze(analyzer);
-        switch (type) {
-            case STORAGE:
-                if (!Config.enable_storage_policy) {
-                    throw new UserException("storage policy feature is 
disabled by default. "
-                            + "Enable it by setting 
'enable_storage_policy=true' in fe.conf");
-                }
-                // check auth
-                // check if can create policy and use storage_resource
-                if (!Env.getCurrentEnv().getAccessManager()
-                        .checkGlobalPriv(ConnectContext.get(), 
PrivPredicate.ADMIN)) {
-                    
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
-                            PrivPredicate.ADMIN.getPrivs().toString());
-                }
-                break;
-            case ROW:
-            default:
-                tableName.analyze(analyzer);
-                if (user != null) {
-                    user.analyze();
-                    if (user.isRootUser() || user.isAdminUser()) {
-                        
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, 
"CreatePolicyStmt",
-                                user.getQualifiedUser(), user.getHost(), 
tableName.getTbl());
-                    }
-                }
-                // check auth
-                if (!Env.getCurrentEnv().getAccessManager()
-                        .checkGlobalPriv(ConnectContext.get(), 
PrivPredicate.GRANT)) {
-                    
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
-                            PrivPredicate.GRANT.getPrivs().toString());
-                }
-        }
+
     }
 
     @Override
     public String toSql() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("CREATE ").append(type).append(" POLICY ");
-        if (ifNotExists) {
-            sb.append("IF NOT EXISTS");
-        }
-        sb.append(policyName);
-        switch (type) {
-            case STORAGE:
-                sb.append(" PROPERTIES(").append(new 
PrintableMap<>(properties, " = ", true, false)).append(")");
-                break;
-            case ROW:
-            default:
-                sb.append(" ON ").append(tableName.toSql()).append(" AS 
").append(filterType)
-                        .append(" TO ");
-                if (user == null) {
-                    sb.append("ROLE ").append(roleName);
-                } else {
-                    sb.append(user.getQualifiedUser());
-                }
-                sb.append(" USING ").append(wherePredicate.toSql());
-        }
-        return sb.toString();
+        return "";

Review Comment:
   The toSql() method now returns an empty string instead of a valid SQL 
representation. Please add a comment to clarify that this is intentional due to 
the removal of the old optimizer dependency, so future maintainers understand 
the rationale.



-- 
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-unsubscr...@doris.apache.org

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


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

Reply via email to