in src/main/java/com/amazonaws/services/glue/catalog/HiveGlueCatalogSyncAgent.java [354:385]
public void onAddPartition(AddPartitionEvent partitionEvent) throws MetaException {
super.onAddPartition(partitionEvent);
if (partitionEvent.getStatus()) {
Table table = partitionEvent.getTable();
if (table.getTableType().equals(EXTERNAL_TABLE_TYPE) && table.getSd().getLocation().startsWith("s3")) {
String fqtn = getFqtn(table);
if (fqtn != null && !fqtn.equals("")) {
partitionEvent.getPartitionIterator().forEachRemaining(p -> {
String partitionSpec = getPartitionSpec(table, p);
if (p.getSd().getLocation().startsWith("s3")) {
String addPartitionDDL = String.format(
"alter table %s add if not exists partition(%s) location '%s'", fqtn, partitionSpec,
p.getSd().getLocation());
if (!addToAthenaQueue(addPartitionDDL)) {
LOG.error("Failed to add the AddPartition event to the processing queue");
}
} else {
LOG.debug(String.format("Not adding partition (%s) as it is not S3 based (location %s)",
partitionSpec, p.getSd().getLocation()));
}
});
}
} else {
LOG.debug(String.format("Ignoring Add Partition Event for Table %s as it is not stored on S3",
table.getTableName()));
}
}
}