if (PartitionName.isPartition(index.name())) {
String tableName = PartitionName.tableName(index.name());
// check if alias exists
if (clusterService.state().metaData().hasConcreteIndex(tableName)) {
// get DocTableInfo for virtual partitioned table
DocTableInfo info = new DocTableInfoBuilder(
docSchemaInfo,
new TableIdent(DocSchemaInfo.NAME, tableName),
clusterService, transportPutIndexTemplateAction, true).build();
assert info.isPartitioned();
int i = 0;
int numPartitionedColumns = info.partitionedByColumns().size();
PartitionName partitionName;
try {
partitionName = PartitionName.fromString(
index.name(),
tableName);
} catch (IllegalArgumentException e) {
throw new UnhandledServerException(
String.format(Locale.ENGLISH,
"Unable to load PARTITIONED BY columns from partition %s",
index.name()),
e
);
}
assert partitionName.values().size() == numPartitionedColumns : "invalid number of partitioned columns";
for (ReferenceInfo partitionedInfo : info.partitionedByColumns()) {
builder.put(partitionedInfo.ident(), new PartitionedColumnExpression(
partitionedInfo,
partitionName.values().get(i)
));
i++;