1717
1818package org .apache .doris .nereids .trees .plans .commands ;
1919
20+ import org .apache .doris .analysis .BrokerDesc ;
2021import org .apache .doris .analysis .StmtType ;
22+ import org .apache .doris .analysis .StorageBackend ;
2123import org .apache .doris .catalog .Column ;
2224import org .apache .doris .catalog .Env ;
2325import org .apache .doris .catalog .OlapTable ;
4951import org .apache .doris .nereids .trees .expressions .literal .TinyIntLiteral ;
5052import org .apache .doris .nereids .trees .plans .PlanType ;
5153import org .apache .doris .nereids .trees .plans .commands .info .BulkLoadDataDesc ;
52- import org .apache .doris .nereids .trees .plans .commands .info .BulkStorageDesc ;
5354import org .apache .doris .nereids .trees .plans .commands .info .DMLCommandType ;
5455import org .apache .doris .nereids .trees .plans .commands .insert .InsertIntoTableCommand ;
5556import org .apache .doris .nereids .trees .plans .logical .LogicalCheckPolicy ;
@@ -89,7 +90,7 @@ public class LoadCommand extends Command implements ForwardWithSync {
8990 public static final Logger LOG = LogManager .getLogger (LoadCommand .class );
9091
9192 private final String labelName ;
92- private final BulkStorageDesc bulkStorageDesc ;
93+ private final BrokerDesc brokerDesc ;
9394 private final Set <String > sinkTableNames = new HashSet <>();
9495 private final List <BulkLoadDataDesc > sourceInfos ;
9596 private final Map <String , String > properties ;
@@ -100,13 +101,13 @@ public class LoadCommand extends Command implements ForwardWithSync {
100101 /**
101102 * constructor of ExportCommand
102103 */
103- public LoadCommand (String labelName , List <BulkLoadDataDesc > sourceInfos , BulkStorageDesc bulkStorageDesc ,
104+ public LoadCommand (String labelName , List <BulkLoadDataDesc > sourceInfos , BrokerDesc brokerDesc ,
104105 Map <String , String > properties , String comment ) {
105106 super (PlanType .LOAD_COMMAND );
106107 this .labelName = Objects .requireNonNull (labelName .trim (), "labelName should not null" );
107108 this .sourceInfos = Objects .requireNonNull (ImmutableList .copyOf (sourceInfos ), "sourceInfos should not null" );
108109 this .properties = Objects .requireNonNull (ImmutableMap .copyOf (properties ), "properties should not null" );
109- this .bulkStorageDesc = Objects .requireNonNull (bulkStorageDesc , "bulkStorageDesc should not null" );
110+ this .brokerDesc = Objects .requireNonNull (brokerDesc , "brokerDesc should not null" );
110111 this .comment = Objects .requireNonNull (comment , "comment should not null" );
111112 }
112113
@@ -151,7 +152,7 @@ private LogicalPlan completeQueryPlan(ConnectContext ctx, BulkLoadDataDesc dataD
151152 LOG .debug ("nereids load stmt before conversion: {}" , dataDesc ::toSql );
152153 }
153154 // 1. build source projects plan (select col1,col2... from tvf where prefilter)
154- Map <String , String > tvfProperties = getTvfProperties (dataDesc , bulkStorageDesc );
155+ Map <String , String > tvfProperties = getTvfProperties (dataDesc , brokerDesc );
155156 LogicalPlan tvfLogicalPlan = new LogicalCheckPolicy <>(getUnboundTVFRelation (tvfProperties ));
156157 tvfLogicalPlan = buildTvfQueryPlan (dataDesc , tvfProperties , tvfLogicalPlan );
157158
@@ -431,15 +432,15 @@ private static void checkAndAddSequenceCol(OlapTable olapTable, BulkLoadDataDesc
431432
432433 private UnboundTVFRelation getUnboundTVFRelation (Map <String , String > properties ) {
433434 UnboundTVFRelation relation ;
434- if (bulkStorageDesc .getStorageType () == BulkStorageDesc .StorageType .S3 ) {
435+ if (brokerDesc .getStorageType () == StorageBackend .StorageType .S3 ) {
435436 relation = new UnboundTVFRelation (StatementScopeIdGenerator .newRelationId (),
436437 S3TableValuedFunction .NAME , new Properties (properties ));
437- } else if (bulkStorageDesc .getStorageType () == BulkStorageDesc .StorageType .HDFS ) {
438+ } else if (brokerDesc .getStorageType () == StorageBackend .StorageType .HDFS ) {
438439 relation = new UnboundTVFRelation (StatementScopeIdGenerator .newRelationId (),
439440 HdfsTableValuedFunction .NAME , new Properties (properties ));
440441 } else {
441442 throw new UnsupportedOperationException ("Unsupported load storage type: "
442- + bulkStorageDesc .getStorageType ());
443+ + brokerDesc .getStorageType ());
443444 }
444445 return relation ;
445446 }
@@ -454,8 +455,8 @@ private static OlapTable getOlapTable(ConnectContext ctx, BulkLoadDataDesc dataD
454455 return targetTable ;
455456 }
456457
457- private static Map <String , String > getTvfProperties (BulkLoadDataDesc dataDesc , BulkStorageDesc bulkStorageDesc ) {
458- Map <String , String > tvfProperties = new HashMap <>(bulkStorageDesc .getProperties ());
458+ private static Map <String , String > getTvfProperties (BulkLoadDataDesc dataDesc , BrokerDesc brokerDesc ) {
459+ Map <String , String > tvfProperties = new HashMap <>(brokerDesc .getProperties ());
459460 String fileFormat = dataDesc .getFormatDesc ().getFileFormat ().orElse ("csv" );
460461 if ("csv" .equalsIgnoreCase (fileFormat )) {
461462 dataDesc .getFormatDesc ().getColumnSeparator ().ifPresent (sep ->
@@ -469,7 +470,7 @@ private static Map<String, String> getTvfProperties(BulkLoadDataDesc dataDesc, B
469470 List <String > filePaths = dataDesc .getFilePaths ();
470471 // TODO: support multi location by union
471472 String listFilePath = filePaths .get (0 );
472- if (bulkStorageDesc .getStorageType () == BulkStorageDesc .StorageType .S3 ) {
473+ if (brokerDesc .getStorageType () == StorageBackend .StorageType .S3 ) {
473474 // TODO: check file path by s3 fs list status
474475 tvfProperties .put ("uri" , listFilePath );
475476 }
0 commit comments