dailai commented on code in PR #6449:
URL: https://github.com/apache/seatunnel/pull/6449#discussion_r1513984812


##########
seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/sink/PaimonSink.java:
##########
@@ -108,43 +104,45 @@ public void prepare(Config pluginConfig) throws 
PrepareFailException {
         final CatalogContext catalogContext = CatalogContext.create(options, 
hadoopConf);
         try (Catalog catalog = CatalogFactory.createCatalog(catalogContext)) {
             Identifier identifier = Identifier.create(database, table);
+            // Auto create if not exists the database and table for paimon
+            catalog.createDatabase(database, true);
+            TableSchema tableSchema = catalogTable.getTableSchema();
+            this.seaTunnelRowType = tableSchema.toPhysicalRowDataType();
+            Schema paimonTableSchema = SchemaUtil.toPaimonSchema(tableSchema);
+            catalog.createTable(identifier, paimonTableSchema, true);

Review Comment:
   > Please move create table logic to `SaveModeHandler` part. You can refer
   > 
   > 
https://github.com/apache/seatunnel/blob/6ec16ac46fe8b36c733556f100ac7bb7e4a7e9f4/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SupportSaveMode.java#L23
   
   ok



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to