Search in sources :

Example 1 with SCAN_INDEX_NAME_SUFFIX

use of org.apache.ignite.internal.processors.query.h2.opt.H2TableScanIndex.SCAN_INDEX_NAME_SUFFIX 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;
}
Also used : IndexInformation(org.apache.ignite.internal.processors.query.h2.database.IndexInformation) H2TreeIndexBase(org.apache.ignite.internal.processors.query.h2.database.H2TreeIndexBase) ArrayList(java.util.ArrayList) Index(org.h2.index.Index) H2TreeIndex(org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex) SpatialIndex(org.h2.index.SpatialIndex) IndexColumn(org.h2.table.IndexColumn)

Aggregations

ArrayList (java.util.ArrayList)1 H2TreeIndex (org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex)1 H2TreeIndexBase (org.apache.ignite.internal.processors.query.h2.database.H2TreeIndexBase)1 IndexInformation (org.apache.ignite.internal.processors.query.h2.database.IndexInformation)1 Index (org.h2.index.Index)1 SpatialIndex (org.h2.index.SpatialIndex)1 IndexColumn (org.h2.table.IndexColumn)1