starocean999 commented on code in PR #47554: URL: https://github.com/apache/doris/pull/47554#discussion_r1948344635
########## fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java: ########## @@ -5511,5 +5516,116 @@ public LogicalPlan visitDropDatabase(DropDatabaseContext ctx) { DropDatabaseInfo databaseInfo = new DropDatabaseInfo(ifExists, databaseNameParts, force); return new DropDatabaseCommand(databaseInfo); } + + @Override + public PasswordOptions visitPasswordOption(DorisParser.PasswordOptionContext ctx) { + int historyPolicy = -2; + long expirePolicySecond = -2; + int reusePolicy = -2; + int loginAttempts = -2; + long passwordLockSecond = -2; + int accountUnlocked = -2; + + if (ctx.historyDefault != null) { + historyPolicy = -1; + } else if (ctx.historyValue != null) { + historyPolicy = Integer.parseInt(ctx.historyValue.getText()); + } + + if (ctx.expireDefault != null) { + expirePolicySecond = -1; + } else if (ctx.expireNever != null) { + expirePolicySecond = 0; + } else if (ctx.expireValue != null) { + long value = Long.parseLong(ctx.expireValue.getText()); + expirePolicySecond = getSecond(value, ctx.expireTimeUnit.getText()); + } + + if (ctx.reuseValue != null) { + reusePolicy = Integer.parseInt(ctx.reuseValue.getText()); + } + + if (ctx.attemptsValue != null) { + loginAttempts = Integer.parseInt(ctx.attemptsValue.getText()); + } + + if (ctx.lockUnbounded != null) { + passwordLockSecond = -1; + } else if (ctx.lockValue != null) { + long value = Long.parseLong(ctx.lockValue.getText()); + passwordLockSecond = getSecond(value, ctx.lockTimeUint.getText()); + } + + if (ctx.ACCOUNT_LOCK() != null) { + accountUnlocked = -1; + } else if (ctx.ACCOUNT_UNLOCK() != null) { + accountUnlocked = 1; + } + + if (expirePolicySecond == -2 && historyPolicy == -2 && reusePolicy == -2 + && loginAttempts == -2 && passwordLockSecond == -2 && accountUnlocked == -2) { + return PasswordOptions.UNSET_OPTION; + } + + return new PasswordOptions(expirePolicySecond, + historyPolicy, + reusePolicy, + loginAttempts, + passwordLockSecond, + accountUnlocked); + } + + private long getSecond(long value, String s) { + long ans = 0; + + switch (s) { + case "DAY": + ans = value * 24 * 60 * 60; + break; + case "HOUR": + ans = value * 60 * 60; + break; + default: + ans = value; + } + return ans; + } + + @Override + public LogicalPlan visitCreateUser(CreateUserContext ctx) { + String comment = ""; + if (ctx.COMMENT() != null) { + comment = stripQuotes(ctx.STRING_LITERAL(0).getText()); Review Comment: ```suggestion String comment = visitCommentSpec(ctx.commentSpec()); ``` -- 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