Skip to content

Commit

Permalink
[HUDI-2990] Sync to HMS when deleting partitions
Browse files Browse the repository at this point in the history
  • Loading branch information
XuQianJin-Stars committed Dec 13, 2021
1 parent c556f44 commit 6184de8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public void updatePartitionsToTable(String tableName, List<String> changedPartit

@Override
public void dropPartitionsToTable(String tableName, List<String> partitionsToDelete) {
throw new UnsupportedOperationException("Not support dropPartitionsToTables yet.");
throw new UnsupportedOperationException("Not support dropPartitionsToTable yet.");
}

public Map<List<String>, String> scanTablePartitions(String tableName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ protected void syncHoodieTable(String tableName, boolean useRealtimeInputFormat,
// Check if the necessary table exists
boolean tableExists = hoodieHiveClient.doesTableExist(tableName);

// check if isDeletePartition
boolean isDeletePartition = hoodieHiveClient.isDeletePartition();
// check if isDropPartition
boolean isDropPartition = hoodieHiveClient.isDropPartition();

// check if schemaChanged
boolean schemaChanged = false;

if (!isDeletePartition) {
if (!isDropPartition) {
// Get the parquet schema for this table looking at the latest commit
MessageType schema = hoodieHiveClient.getDataSchema();

Expand Down Expand Up @@ -199,7 +199,7 @@ protected void syncHoodieTable(String tableName, boolean useRealtimeInputFormat,
LOG.info("Storage partitions scan complete. Found " + writtenPartitionsSince.size());

// Sync the partitions if needed
boolean partitionsChanged = syncPartitions(tableName, writtenPartitionsSince, isDeletePartition);
boolean partitionsChanged = syncPartitions(tableName, writtenPartitionsSince, isDropPartition);
boolean meetSyncConditions = schemaChanged || partitionsChanged;
if (!cfg.isConditionalSync || meetSyncConditions) {
hoodieHiveClient.updateLastCommitTimeSynced(tableName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public MessageType getDataSchema() {
}
}

public boolean isDeletePartition() {
public boolean isDropPartition() {
try {
Option<HoodieCommitMetadata> hoodieCommitMetadata;
if (withOperationField) {
Expand Down

0 comments on commit 6184de8

Please sign in to comment.