String indexName,
Table table,
QueryContext context,
DDLFunctions ddl
) {
IndexColumnList columnList = id.getIndexColumnList();
Index tableIndex;
TableName constraintName = null;
if(indexName == null) {
indexName = namer.generateIndexName(null, columnList.get(0).getColumnName());
}
if(id.isUnique()) {
constraintName = builder.getNameGenerator().generateUniqueConstraintName(table.getName().getSchemaName(), indexName);
}
if (columnList.functionType() == IndexColumnList.FunctionType.FULL_TEXT) {
logger.debug ("Building Full text index on table {}", table.getName()) ;
tableIndex = IndexDDL.buildFullTextIndex(builder, table.getName(), indexName, id, null, null);
} else if (IndexDDL.checkIndexType (id, table.getName()) == Index.IndexType.TABLE) {
logger.debug ("Building Table index on table {}", table.getName()) ;
tableIndex = IndexDDL.buildTableIndex (builder, table.getName(), indexName, id, constraintName, null, null);
} else {
logger.debug ("Building Group index on table {}", table.getName());
tableIndex = IndexDDL.buildGroupIndex(builder, table.getName(), indexName, id, null, null);
}
boolean indexIsSpatial = columnList.functionType() == IndexColumnList.FunctionType.Z_ORDER_LAT_LON;
// Can't check isSpatialCompatible before the index columns have been added.
if (indexIsSpatial && !Index.isSpatialCompatible(tableIndex)) {
throw new BadSpatialIndexException(tableIndex.getIndexName().getTableName(), null);
}
StorageFormatNode sfn = id.getStorageFormat();