in hms-lambda-handler/src/main/java/com/amazonaws/athena/hms/handler/CreatePartitionHandler.java [84:110]
Partition build()
{
Partition partition = new Partition();
List<String> partitionNames = table.getPartitionKeys()
.stream()
.map(FieldSchema::getName)
.collect(Collectors.toList());
if (partitionNames.size() != values.size()) {
throw new RuntimeException("Partition values do not match table schema");
}
List<String> spec = IntStream.range(0, values.size())
.mapToObj(i -> partitionNames.get(i) + "=" + values.get(i))
.collect(Collectors.toList());
partition.setDbName(table.getDbName());
partition.setTableName(table.getTableName());
partition.setParameters(parameters);
partition.setValues(values);
partition.setSd(table.getSd().deepCopy());
if (this.location == null) {
partition.getSd().setLocation(table.getSd().getLocation() + "/" + Joiner.on("/").join(spec));
}
else {
partition.getSd().setLocation(location);
}
return partition;
}