Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Zouxxyy committed May 31, 2024
1 parent e3330c8 commit 2866de4
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

import static org.apache.paimon.hive.HiveTypeUtils.toPaimonType;
import static org.apache.paimon.utils.FileUtils.COMMON_IO_FORK_JOIN_POOL;
import static org.apache.paimon.utils.Preconditions.checkArgument;

/** Migrate hive table to paimon table. */
public class HiveMigrator implements Migrator {
Expand All @@ -77,7 +78,6 @@ public class HiveMigrator implements Migrator {
private final String sourceTable;
private final String targetDatabase;
private final String targetTable;
private final Map<String, String> options;
private final CoreOptions coreOptions;
private Boolean delete = true;

Expand All @@ -95,7 +95,6 @@ public HiveMigrator(
this.sourceTable = sourceTable;
this.targetDatabase = targetDatabase;
this.targetTable = targetTable;
this.options = options;
this.coreOptions = new CoreOptions(options);
}

Expand Down Expand Up @@ -252,8 +251,10 @@ public Schema from(
List<FieldSchema> fields,
List<FieldSchema> partitionFields,
Map<String, String> hiveTableOptions) {
HashMap<String, String> paimonOptions = new HashMap<>(this.options);
paimonOptions.put(CoreOptions.BUCKET.key(), "-1");
checkArgument(
coreOptions.bucket() == -1,
"Hive migrator only support unaware-bucket target table");
Map<String, String> paimonOptions = coreOptions.toMap();
// for compatible with hive comment system
if (hiveTableOptions.get("comment") != null) {
paimonOptions.put("hive.comment", hiveTableOptions.get("comment"));
Expand Down

0 comments on commit 2866de4

Please sign in to comment.