codeDing18 commented on code in PR #50203:
URL: https://github.com/apache/doris/pull/50203#discussion_r2092404919
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -6966,6 +6993,124 @@ public LogicalPlan
visitTransactionRollback(DorisParser.TransactionRollbackConte
return new TransactionRollbackCommand();
}
+ @Override
+ public LogicalPlan
visitGrantTablePrivilege(DorisParser.GrantTablePrivilegeContext ctx) {
+ List<AccessPrivilegeWithCols> accessPrivilegeWithCols =
visitPrivilegeList(ctx.privilegeList());
+
+ List<String> parts =
visitMultipartIdentifierOrAsterisk(ctx.multipartIdentifierOrAsterisk());
+ int size = parts.size();
+
+ if (size < 1) {
+ throw new AnalysisException("grant table privilege statement
missing parameters");
+ }
+
+ TablePattern tablePattern = null;
+ if (size == 1) {
+ String db = parts.get(size - 1);
+ tablePattern = new TablePattern(db, "");
+ }
+
+ if (size == 2) {
+ String db = parts.get(size - 2);
+ String tbl = parts.get(size - 1);
+ tablePattern = new TablePattern(db, tbl);
+ }
+
+ if (size == 3) {
+ String ctl = parts.get(size - 3);
+ String db = parts.get(size - 2);
+ String tbl = parts.get(size - 1);
+ tablePattern = new TablePattern(ctl, db, tbl);
+ }
+
+ Optional<UserIdentity> userIdentity = ctx.userIdentify() == null
+ ? Optional.empty() :
Optional.of(visitUserIdentify(ctx.userIdentify()));
+ Optional<String> role = ctx.ROLE() == null
Review Comment:
I think wo can don't worry about it.Because antlr generated class will parse
the syntax. If we use user and role together or don't use user and role, the
generated class that parsing the syntax will throw exception in parse phase
--
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]