if (!column.isPartitionKey()) {
continue;
}
Expression key = equal(nameReference("partition_key"), new StringLiteral(column.getName()));
Expression value = caseWhen(key, nameReference("partition_value"));
value = new Cast(value, Type.fromRaw(column.getType()).getName());
Expression function = functionCall("max", value);
selectList.add(new SingleColumn(function, column.getName()));
wrappedList.add(unaliasedName(column.getName()));
}