Package com.foundationdb.ais.model

Examples of com.foundationdb.ais.model.Index


    public void loadIndexStatistics(Session session,
                                    String schema, File file) throws IOException {
        AkibanInformationSchema ais = schemaManager.getAis(session);
        Map<Index,IndexStatistics> stats = new IndexStatisticsYamlLoader(ais, schema, store).load(file);
        for (Map.Entry<Index,IndexStatistics> entry : stats.entrySet()) {
            Index index = entry.getKey();
            IndexStatistics indexStatistics = entry.getValue();
            storeStats.storeIndexStatistics(session, index, indexStatistics);
            cache.put(index, indexStatistics);
            backgroundState.remove(index);
        }
View Full Code Here


        }

        private void updateIndex(Session session, IndexName indexName) {
            Map<Index,IndexStatistics> statistics;
            try (TransactionService.CloseableTransaction txn = txnService.beginCloseableTransaction(session)) {
                Index index = null;
                AkibanInformationSchema ais = schemaManager.getAis(session);
                Table table = ais.getTable(indexName.getFullTableName());
                if (table != null)
                    index = table.getIndex(indexName.getName());
                if (index == null) {
View Full Code Here

                                               (String)map.get(TABLE_NAME_KEY));
        Table table = ais.getTable(tableName);
        if (table == null)
            throw new NoSuchTableException(tableName);
        String indexName = (String)map.get(INDEX_NAME_KEY);
        Index index = table.getIndex(indexName);
        if (index == null) {
            index = table.getGroup().getIndex(indexName);
            if (index == null) {
                if (statsIgnoreMissingIndexes)
                    return;
View Full Code Here

                String iName = row.value(2).getString();
                indexName = new IndexName(new TableName(schema, tableName), iName);
                indexID = row.value(3).getInt32();

                Table table = getAIS(session).getTable(indexName.getFullTableName());
                Index index = (table != null) ? table.getFullTextIndex(indexName.getName()) : null;
                // May have been deleted or recreated
                if(index != null && index.getIndexId() == indexID) {
                    break;
                }

                store.deleteRow(session, ((AbstractRow)row).rowData(), false);
                indexName = null;
View Full Code Here

        return indexRowTypes.get(indexID);
    }

    public void addIndexRowType(IndexRowType indexRowType)
    {
        Index index = indexRowType.index();
        int requiredEntries = index.getIndexId() + 1;
        while (indexRowTypes.size() < requiredEntries) {
            indexRowTypes.add(null);
        }
        indexRowTypes.set(index.getIndexId(), indexRowType);
    }
View Full Code Here

    public void processDelete (Session session, AkibanInformationSchema ais, TableName tableName, String identifiers) {
        ProcessContext context = new ProcessContext (ais, session, tableName);
       
        deleteGenerator = getGenerator (CACHED_DELETE_GENERATOR, context);

        Index pkIndex = context.table.getPrimaryKeyIncludingInternal().getIndex();
        List<List<Object>> pks = PrimaryKeyParser.parsePrimaryKeys(identifiers, pkIndex);
       
        Cursor cursor = null;

        try {
View Full Code Here

            return stream;
        }

        protected RowStream assembleSingleIndexScan(SingleIndexScan indexScan, IntersectionMode forIntersection) {
            RowStream stream = new RowStream();
            Index index = indexScan.getIndex();
            IndexRowType indexRowType = schema.indexRowType(index);
            IndexScanSelector selector;
            if (index.isTableIndex()) {
                selector = IndexScanSelector.inner(index);
            }
            else {
                switch (index.getJoinType()) {
                case LEFT:
                    selector = IndexScanSelector
                        .leftJoinAfter(index,
                                       indexScan.getLeafMostInnerTable().getTable().getTable());
                    break;
                case RIGHT:
                    selector = IndexScanSelector
                        .rightJoinUntil(index,
                                        indexScan.getRootMostInnerTable().getTable().getTable());
                    break;
                default:
                    throw new AkibanInternalException("Unknown index join type " +
                                                      index);
                }
            }
            if (index.isSpatial()) {
                stream.operator = API.indexScan_Default(indexRowType,
                                                        assembleSpatialIndexKeyRange(indexScan, null),
                                                        API.ordering(), // TODO: what ordering?
                                                        selector,
                                                        rulesContext.getPipelineConfiguration().getIndexScanLookaheadQuantum());
View Full Code Here

            affectedTables.add(aisTable);
            return schema.tableRowType(aisTable);
        }

        protected IndexRowType getIndexRowType(SingleIndexScan index) {
            Index aisIndex = index.getIndex();
            AkibanInformationSchema ais = schema.ais();
            for (int i : aisIndex.getAllTableIDs()) {
                affectedTables.add(ais.getTable(i));
            }
            return schema.indexRowType(aisIndex);
        }
View Full Code Here

    {
        super(context, iterationHelper);
        assert keyRange.spatial();
        this.iterationHelper = iterationHelper;
        IndexRowType physicalIndexRowType = keyRange.indexRowType().physicalRowType();
        Index index = keyRange.indexRowType().index();
        Space space = index.space();
        int latColumn = index.firstSpatialArgument();
        int lonColumn = latColumn + 1;
        // The index column selector needs to select all the columns before the z column, and the z column itself.
        IndexRowPrefixSelector indexColumnSelector = new IndexRowPrefixSelector(latColumn + 1);
        IndexBound loBound = keyRange.lo();
        ValueRecord loExpressions = loBound.boundExpressions(context, bindings);
        // Compute z-value at beginning of forward and backward scans
        TInstance latInstance = index.getAllColumns().get(latColumn).getColumn().getType();
        TInstance lonInstance = index.getAllColumns().get(lonColumn).getColumn().getType();
        BigDecimal lat = TBigDecimal.getWrapper(loExpressions.value(latColumn), latInstance).asBigDecimal();
        BigDecimal lon = TBigDecimal.getWrapper(loExpressions.value(lonColumn), lonInstance).asBigDecimal();
        zStart = Spatial.shuffle(space, lat.doubleValue(), lon.doubleValue());
        // Cursors going forward from starting z value (inclusive), and backward from the same z value (exclusive)
        int indexRowFields = physicalIndexRowType.nFields();
View Full Code Here

        this.endKeyKey = adapter.createKey();
        // Set up type info, allowing for spatial indexes
        //this.collators = sortKeyAdapter.createAkCollators(startBoundColumns);
        this.types = sortKeyAdapter.createTInstances(startBoundColumns);
        Index index = keyRange.indexRowType().index();
        int firstSpatialColumn;
        int dimensions;
        if (index.isSpatial()) {
            firstSpatialColumn = index.firstSpatialArgument();
            dimensions = index.dimensions();
        } else {
            firstSpatialColumn = Integer.MAX_VALUE;
            dimensions = 0;
        }
        List<IndexColumn> indexColumns = index().getAllColumns();
View Full Code Here

TOP

Related Classes of com.foundationdb.ais.model.Index

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.