in hms-lambda-handler/src/main/java/com/amazonaws/athena/hms/handler/GetPartitionNamesHandler.java [37:57]
public GetPartitionNamesResponse handleRequest(GetPartitionNamesRequest request, Context context)
{
HiveMetaStoreConf conf = getConf();
try {
context.getLogger().log("Connecting to embedded HMS client");
HiveMetaStoreClient client = getClient();
context.getLogger().log("Fetching partition Names for DB: " + request.getDbName() + ", table: " + request.getTableName());
List<String> partitionNameList =
client.listPartitionNames(request.getDbName(), request.getTableName(), request.getMaxSize());
context.getLogger().log("Fetched partitions: " + (partitionNameList == null || partitionNameList.isEmpty() ? 0 : partitionNameList.size()));
GetPartitionNamesResponse response = new GetPartitionNamesResponse();
if (partitionNameList != null && !partitionNameList.isEmpty()) {
response.setPartitionNames(partitionNameList);
}
return response;
}
catch (Exception e) {
context.getLogger().log("Exception: " + e.getMessage());
throw new RuntimeException(e);
}
}