Skip to content
Merged
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 @@ -812,12 +812,14 @@ public void testDropPartition(String syncMode) throws Exception {
assertEquals(hiveClient.getTableSchema(HiveTestUtil.hiveSyncConfig.tableName).size(),
hiveClient.getDataSchema().getColumns().size() + 1,
"Hive Schema should match the table schema + partition field");
assertEquals(1, hiveClient.scanTablePartitions(hiveSyncConfig.tableName).size(),
List<Partition> partitions = hiveClient.scanTablePartitions(hiveSyncConfig.tableName);
assertEquals(1, partitions.size(),
"Table partitions should match the number of partitions we wrote");
assertEquals(instantTime, hiveClient.getLastCommitTimeSynced(hiveSyncConfig.tableName).get(),
"The last commit that was synced should be updated in the TBLPROPERTIES");
// create a replace commit to delete current partitions
HiveTestUtil.createReplaceCommit("101", "2021/12/28", WriteOperationType.DELETE_PARTITION);
String partitiontoDelete = partitions.get(0).getValues().get(0).replace("-","/");
// create a replace commit to delete current partitions+
HiveTestUtil.createReplaceCommit("101", partitiontoDelete, WriteOperationType.DELETE_PARTITION, true, true);

// sync drop partitins
tool = new HiveSyncTool(hiveSyncConfig, HiveTestUtil.getHiveConf(), fileSystem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,10 @@ public static void createCOWTable(String instantTime, int numberOfPartitions, bo
createCommitFile(commitMetadata, instantTime);
}

public static void createReplaceCommit(String instantTime, String partitions, WriteOperationType type)
public static void createReplaceCommit(String instantTime, String partitions, WriteOperationType type, boolean isParquetSchemaSimple, boolean useSchemaFromCommitMetadata)
throws IOException {
HoodieReplaceCommitMetadata replaceCommitMetadata = new HoodieReplaceCommitMetadata();
addSchemaToCommitMetadata(replaceCommitMetadata, isParquetSchemaSimple, useSchemaFromCommitMetadata);
replaceCommitMetadata.setOperationType(type);
Map<String, List<String>> partitionToReplaceFileIds = new HashMap<>();
partitionToReplaceFileIds.put(partitions, new ArrayList<>());
Expand Down