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


##########
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
   
   Hi, I checked the code. If I move the code to the SaveModeHandler,the table 
init will lead to error(table not exists)
   
![image](https://github.com/apache/seatunnel/assets/18141150/237a0c0f-dd8c-48c2-8df9-79fb6d4c55d8)
   



-- 
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