morningman commented on code in PR #23635: URL: https://github.com/apache/doris/pull/23635#discussion_r1314184096
########## fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ExportCommand.java: ########## @@ -49,35 +100,248 @@ public class ExportCommand extends Command implements ForwardWithSync { public ExportCommand(List<String> nameParts, List<String> partitions, String whereSql, String path, Map<String, String> fileProperties, BrokerDesc brokerDesc) { super(PlanType.EXPORT_COMMAND); - this.nameParts = nameParts; + this.nameParts = ImmutableList.copyOf(Objects.requireNonNull(nameParts, "nameParts should not be null")); + this.path = Objects.requireNonNull(path.trim(), "export path should not be null"); this.partitionsNameList = partitions; this.whereSql = whereSql; - this.path = path.trim(); this.fileProperties = fileProperties; - this.brokerDesc = brokerDesc; + if (brokerDesc == null) { + this.brokerDesc = new BrokerDesc("local", StorageBackend.StorageType.LOCAL, null); + } else { + this.brokerDesc = brokerDesc; + } } @Override public void run(ConnectContext ctx, StmtExecutor executor) throws Exception { - ExportStmt exportStmt = generateExportStmt(); - Analyzer analyzer = new Analyzer(ctx.getEnv(), ctx); - exportStmt.analyze(analyzer); - ctx.getEnv().getExportMgr().addExportJobAndRegisterTask(exportStmt); + // get tblName + TableName tblName = getTableName(ctx); + + // check auth + if (!Env.getCurrentEnv().getAccessManager().checkTblPriv(ctx, tblName.getDb(), tblName.getTbl(), + PrivPredicate.SELECT)) { + ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "EXPORT", + ctx.getQualifiedUser(), + ctx.getRemoteIP(), + tblName.getDb() + ": " + tblName.getTbl()); + } + + // convert key to lowercase + Map<String, String> lowercaseProperties = convertPropertyKeyToLowercase(fileProperties); + + // check phases + checkAllParameter(ctx, tblName, lowercaseProperties); + + ExportJob exportJob = generateExportJob(ctx, lowercaseProperties, tblName); + // register job + ctx.getEnv().getExportMgr().addExportJobAndRegisterTask(exportJob); + } + + private void checkAllParameter(ConnectContext ctx, TableName tblName, Map<String, String> lowercaseProperties) Review Comment: ```suggestion private void checkAllParameters(ConnectContext ctx, TableName tblName, Map<String, String> lowercaseProperties) ``` -- 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