morningman commented on code in PR #22629:
URL: https://github.com/apache/doris/pull/22629#discussion_r1287118272


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/GrantStmt.java:
##########
@@ -48,21 +55,24 @@ public class GrantStmt extends DdlStmt {
     private TablePattern tblPattern;
     private ResourcePattern resourcePattern;
     private WorkloadGroupPattern workloadGroupPattern;
-    private List<Privilege> privileges;
+    private Set<Privilege> privileges = Sets.newHashSet();
+    private Map<ColPrivilegeKey, Set<String>> colPrivileges = 
Maps.newHashMap();

Review Comment:
   Add comment to explain the key and value of this map



##########
fe/fe-core/src/main/java/org/apache/doris/analysis/GrantStmt.java:
##########
@@ -48,21 +55,24 @@ public class GrantStmt extends DdlStmt {
     private TablePattern tblPattern;
     private ResourcePattern resourcePattern;
     private WorkloadGroupPattern workloadGroupPattern;
-    private List<Privilege> privileges;
+    private Set<Privilege> privileges = Sets.newHashSet();
+    private Map<ColPrivilegeKey, Set<String>> colPrivileges = 
Maps.newHashMap();
     // Indicates that these roles are granted to a user
     private List<String> roles;
+    List<AccessPrivilegeWithCols> accessPrivileges;

Review Comment:
   ```suggestion
       private List<AccessPrivilegeWithCols> accessPrivileges;
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/PrivPredicate.java:
##########
@@ -110,6 +110,18 @@ public Operator getOp() {
         return op;
     }
 
+    // Determine which column Privilege correspond to PrivPredicate
+    //The current logic is to include a SELECT_ PRIV returns SELECT_ PRIV, if 
load is included_ PRIV returns LOAD_ PRIV,
+    // the order cannot be reversed
+    public Privilege getColPrivilege() {
+        if (privs.get(Privilege.SELECT_PRIV.getIdx())) {
+            return Privilege.SELECT_PRIV;
+        } else if (privs.get(Privilege.LOAD_PRIV.getIdx())) {
+            return Privilege.LOAD_PRIV;
+        }
+        return null;

Review Comment:
   Better not return null?
   Consider to add a new enum, such as UNKNOWN or something



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to