HHoflittlefish777 commented on code in PR #19142: URL: https://github.com/apache/doris/pull/19142#discussion_r1185743784
########## fe/fe-core/src/main/java/org/apache/doris/load/loadv2/BulkLoadJob.java: ########## @@ -376,4 +377,37 @@ private String getBrokerUserName() { } return null; } + + // ---------------- for lod stmt ---------------- + public static BulkLoadJob fromInsertStmt(InsertStmt insertStmt) throws DdlException { + // get db id + String dbName = insertStmt.getLoadLabel().getDbName(); + Database db = Env.getCurrentInternalCatalog().getDbOrDdlException(dbName); + + // create job + BulkLoadJob bulkLoadJob; + try { + switch (insertStmt.getLoadType()) { + case BROKER_LOAD: + bulkLoadJob = new BrokerLoadJob(db.getId(), insertStmt.getLoadLabel().getLabelName(), + (BrokerDesc) insertStmt.getResourceDesc(), + insertStmt.getOrigStmt(), insertStmt.getUserInfo()); + break; + case SPARK_LOAD: + bulkLoadJob = new SparkLoadJob(db.getId(), insertStmt.getLoadLabel().getLabelName(), + insertStmt.getResourceDesc(), + insertStmt.getOrigStmt(), insertStmt.getUserInfo()); + break; + default: + throw new DdlException("Unknown load job type."); + } + bulkLoadJob.setComment(insertStmt.getComments()); + bulkLoadJob.setJobProperties(insertStmt.getProperties()); + // TODO(tsy): use generic and change the param in checkAndSetDataSourceInfo + bulkLoadJob.checkAndSetDataSourceInfo(db, (List<DataDescription>) insertStmt.getDataDescList()); + return bulkLoadJob; + } catch (MetaNotFoundException e) { + throw new DdlException(e.getMessage()); Review Comment: I think provide more detailed error information maybe better. -- 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