Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class InputOutputFormat {
}

public static OutputFormat <Row> createOutputFormat(
Catalog catalog, DynamicTableFactory.Context context, Map <String, String> partitions) {
Catalog catalog, DynamicTableFactory.Context context, Map <String, String> partitions, Boolean overwriteSink) {

if (!(catalog instanceof HiveCatalog)) {
throw new RuntimeException("Catalog should be hive catalog.");
Expand All @@ -72,6 +72,8 @@ public static OutputFormat <Row> createOutputFormat(
hiveTableSink.applyStaticPartition(partitions);
}

hiveTableSink.applyOverwrite(overwriteSink);

return hiveTableSink.getOutputFormat();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,7 @@ public boolean isTemporary() {
return factory.doAsThrowRuntime(() -> {

String partitionSpec = params.get(HiveCatalogParams.PARTITION);
boolean overwriteSink = params.get(HiveCatalogParams.OVERWRITE_SINK);

Map <String, String> partitions = null;
if (!StringUtils.isNullOrWhitespaceOnly(partitionSpec)) {
Expand All @@ -844,10 +845,10 @@ public boolean isTemporary() {
true, Thread.currentThread().getContextClassLoader()
);

Method method = inputOutputFormat.getMethod("createOutputFormat", Catalog.class, DynamicTableFactory.Context.class, Map.class);
Method method = inputOutputFormat.getMethod("createOutputFormat", Catalog.class, DynamicTableFactory.Context.class, Map.class, Boolean.class);

OutputFormat<Row> internalRet =
(OutputFormat <Row>) method.invoke(null, catalog, context, partitions);
(OutputFormat <Row>) method.invoke(null, catalog, context, partitions, overwriteSink);

return new RichOutputFormatWithClassLoader(factory, internalRet);
});
Expand Down