in hms-lambda-handler/src/main/java/com/amazonaws/athena/hms/handler/AddPartitionsHandler.java [41:67]
public AddPartitionsResponse handleRequest(AddPartitionsRequest request, Context context)
{
HiveMetaStoreConf conf = getConf();
try {
context.getLogger().log("Connecting to embedded HMS client");
HiveMetaStoreClient client = getClient();
boolean isEmpty = request.getPartitionDescs() == null || request.getPartitionDescs().isEmpty();
context.getLogger().log("Adding partitions: " +
(isEmpty ? 0 : request.getPartitionDescs().size()));
if (!isEmpty) {
TDeserializer deserializer = new TDeserializer(getTProtocolFactory());
List<Partition> partitionList = new ArrayList<>();
for (String partitionDesc : request.getPartitionDescs()) {
Partition partition = new Partition();
deserializer.fromString(partition, partitionDesc);
partitionList.add(partition);
}
client.add_partitions(partitionList);
context.getLogger().log("Added partitions: " + partitionList.size());
}
return new AddPartitionsResponse();
}
catch (Exception e) {
context.getLogger().log("Exception: " + e.getMessage());
throw new RuntimeException(e);
}
}