yzeng1618 commented on code in PR #9743:
URL: https://github.com/apache/seatunnel/pull/9743#discussion_r2465198065


##########
seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/sink/HiveSinkFactory.java:
##########
@@ -59,7 +67,25 @@ public OptionRule optionRule() {
             createSink(TableSinkFactoryContext context) {
         ReadonlyConfig readonlyConfig = context.getOptions();
         CatalogTable catalogTable = context.getCatalogTable();
-        return () -> new HiveSink(readonlyConfig, catalogTable);
+
+        return () -> {
+            try {
+                java.util.Map<String, Object> conf =
+                        new 
java.util.LinkedHashMap<>(readonlyConfig.getSourceMap());
+                java.util.Optional<Boolean> overwriteOptional =
+                        readonlyConfig.getOptional(HiveSinkOptions.OVERWRITE);
+                if (overwriteOptional.isPresent() && overwriteOptional.get()) {
+                    conf.put(HiveSinkOptions.DATA_SAVE_MODE.key(), 
DataSaveMode.DROP_DATA.name());
+                }
+                ReadonlyConfig adjusted = ReadonlyConfig.fromMap(conf);
+                return new HiveSink(adjusted, catalogTable);
+            } catch (Exception e) {
+                throw new HiveConnectorException(
+                        HiveConnectorErrorCode.CREATE_HIVE_TABLE_FAILED,
+                        "Failed to create HiveSink: " + e.getMessage(),
+                        e);

Review Comment:
   > Let's do not catch Exception.
   
   Resolved



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