parisni commented on code in PR #11670:
URL: https://github.com/apache/hudi/pull/11670#discussion_r1695487220
##########
hudi-aws/src/main/java/org/apache/hudi/aws/sync/AWSGlueCatalogSyncClient.java:
##########
@@ -536,11 +539,30 @@ public void updateTableSchema(String tableName,
MessageType newSchema) {
.build();
awsGlue.updateTable(request).get();
+ // glue needs partition schema cascading only when columns get updated
+ // TODO: skip cascading when new fields in structs are added to the
schema in last position
+ boolean cascade =
config.getSplitStrings(META_SYNC_PARTITION_FIELDS).size() > 0 &&
!schemaDiff.getUpdateColumnTypes().isEmpty();
+ if (cascade) {
+ LOG.info("Cascading column changes to partitions");
+ List<String> allPartitions = getAllPartitions(tableName).stream()
+ .map(partition -> getStringFromPartition(table.partitionKeys(),
partition.getValues()))
+ .collect(Collectors.toList());
+ updatePartitionsToTable(tableName, allPartitions);
+ }
+ awsGlue.updateTable(request).get();
} catch (Exception e) {
throw new HoodieGlueSyncException("Fail to update definition for table "
+ tableId(databaseName, tableName), e);
}
}
+ private String getStringFromPartition(List<Column> partitionKeys,
List<String> values) {
+ ArrayList<String> partitionValues = new ArrayList<>();
Review Comment:
this one assume both partitions and values are same length and same order.
glad if you have any better implem for this
--
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]