use of org.apache.ignite.internal.processors.query.h2.database.IndexInformation in project ignite by apache.
the class GridH2Table method indexesInformation.
/**
* @return Information about all indexes related to the table.
*/
@SuppressWarnings("ZeroLengthArrayAllocation")
public List<IndexInformation> indexesInformation() {
List<IndexInformation> res = new ArrayList<>();
IndexColumn keyCol = indexColumn(QueryUtils.KEY_COL, SortOrder.ASCENDING);
List<IndexColumn> wrappedKeyCols = H2Utils.treeIndexColumns(rowDescriptor(), new ArrayList<>(2), keyCol, affKeyCol);
// explicit add HASH index, due to we know all their parameters and it doesn't created on non afinity nodes.
res.add(new IndexInformation(false, true, PK_HASH_IDX_NAME, H2IndexType.HASH, H2Utils.indexColumnsSql(H2Utils.unwrapKeyColumns(this, wrappedKeyCols.toArray(new IndexColumn[0]))), null));
// explicit add SCAN index, due to we know all their parameters and it depends on affinity node or not.
res.add(new IndexInformation(false, false, SCAN_INDEX_NAME_SUFFIX, H2IndexType.SCAN, null, null));
for (Index idx : idxs) {
if (idx instanceof H2TreeIndexBase) {
res.add(new IndexInformation(idx.getIndexType().isPrimaryKey(), idx.getIndexType().isUnique(), idx.getName(), H2IndexType.BTREE, H2Utils.indexColumnsSql(H2Utils.unwrapKeyColumns(this, idx.getIndexColumns())), ((H2TreeIndexBase) idx).inlineSize()));
} else if (idx.getIndexType().isSpatial()) {
res.add(new IndexInformation(false, false, idx.getName(), H2IndexType.SPATIAL, H2Utils.indexColumnsSql(idx.getIndexColumns()), null));
}
}
return res;
}
Aggregations