CalvinKirs commented on code in PR #19571: URL: https://github.com/apache/doris/pull/19571#discussion_r1201615009
########## fe/fe-core/src/main/java/org/apache/doris/analysis/UnifiedLoadStmt.java: ########## @@ -55,6 +42,31 @@ public void init() { proxyStmt.setUserInfo(getUserInfo()); } + public static UnifiedLoadStmt buildMysqlLoadStmt(DataDescription dataDescription, Map<String, String> properties, + String comment) { + StatementBase proxyStmt; + final ConnectContext connectContext = ConnectContext.get(); + if (connectContext != null && connectContext.getSessionVariable().isEnableUnifiedLoad()) { + proxyStmt = new MysqlLoadStmt(dataDescription, properties, comment); + } else { + proxyStmt = new LoadStmt(dataDescription, properties, comment); + } + return new UnifiedLoadStmt(proxyStmt); + } + + public static UnifiedLoadStmt buildBrokerLoadStmt(LabelName label, List<DataDescription> dataDescriptions, + BrokerDesc brokerDesc, + Map<String, String> properties, String comment) { + StatementBase proxyStmt; + final ConnectContext connectContext = ConnectContext.get(); + if (connectContext != null && connectContext.getSessionVariable().isEnableUnifiedLoad()) { + proxyStmt = new BrokerLoadStmt(label, dataDescriptions, brokerDesc, properties, comment); + } else { + proxyStmt = new LoadStmt(label, dataDescriptions, brokerDesc, properties, comment); + } + return new UnifiedLoadStmt(proxyStmt); + } + Review Comment: Generally LGTM But it would be better if the code style can be optimized. Similar to this code, we can return directly without passing the else judgment again. -- 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