in xtable-aws/src/main/java/org/apache/xtable/glue/GlueCatalogPartitionSyncOperations.java [277:320]
public void updateTableProperties(
CatalogTableIdentifier catalogTableIdentifier, Map<String, String> propertiesToUpdate) {
HierarchicalTableIdentifier tableIdentifier =
toHierarchicalTableIdentifier(catalogTableIdentifier);
if (isNullOrEmpty(propertiesToUpdate)) {
return;
}
try {
Table table =
GlueCatalogTableUtils.getTable(
glueClient, glueCatalogConfig.getCatalogId(), catalogTableIdentifier);
final Map<String, String> newParams = new HashMap<>();
newParams.putAll(table.parameters());
newParams.putAll(propertiesToUpdate);
final Instant now = Instant.now();
TableInput updatedTableInput =
TableInput.builder()
.name(tableIdentifier.getTableName())
.tableType(table.tableType())
.parameters(newParams)
.partitionKeys(table.partitionKeys())
.storageDescriptor(table.storageDescriptor())
.lastAccessTime(now)
.lastAnalyzedTime(now)
.build();
UpdateTableRequest request =
UpdateTableRequest.builder()
.databaseName(tableIdentifier.getDatabaseName())
.tableInput(updatedTableInput)
.skipArchive(true)
.build();
glueClient.updateTable(request);
} catch (Exception e) {
throw new CatalogSyncException(
"Fail to update last synced params for table "
+ tableIdentifier
+ ": "
+ propertiesToUpdate,
e);
}
}