Package com.foundationdb.ais.model

Examples of com.foundationdb.ais.model.Index


        return groupIndexScanCreator(cID, INDEX_NAME);
    }

    @Override
    protected void postCheckAIS(AkibanInformationSchema ais) {
        Index newIndex = ais.getTable(cID).getGroup().getIndex(INDEX_NAME);
        assertNotNull("new index", newIndex);
    }
View Full Code Here


        return indexScanCreator(tID, INDEX_NAME);
    }

    @Override
    protected void postCheckAIS(AkibanInformationSchema ais) {
        Index newIndex = ais().getTable(tID).getIndex(INDEX_NAME);
        assertNotNull("new index", newIndex);
    }
View Full Code Here

            "c2 int not null",
            "c3 int not null",
            "c4 int not null",
            "c5 int not null",
            "primary key(c1, c2, c3, c4, c5)");
        Index index = createIndex(schemaName(), tableName, "idx", "index_key");
        schema = new Schema(ais());
        tRowType = schema.tableRowType(table(t));
        indexRowType = schema.indexRowType(index);
        adapter = newStoreAdapter(schema);
        queryContext = queryContext(adapter);
View Full Code Here

    protected static OperatorCreator indexScanCreator(final int tID, final String indexName) {
        return new OperatorCreator() {
            @Override
            public Operator create(Schema schema) {
                TableRowType tableRowType = schema.tableRowType(tID);
                Index index = tableRowType.table().getIndex(indexName);
                return API.indexScan_Default(tableRowType.indexRowType(index));
            }
        };
    }
View Full Code Here

    protected static OperatorCreator groupIndexScanCreator(final int tID, final String indexName) {
        return new OperatorCreator() {
            @Override
            public Operator create(Schema schema) {
                TableRowType tableType = schema.tableRowType(tID);
                Index index = schema.tableRowType(tID).table().getGroup().getIndex(indexName);
                IndexRowType indexType = schema.indexRowType(index);
                return API.indexScan_Default(indexType, false, IndexKeyRange.unbounded(indexType), tableType);
            }
        };
    }
View Full Code Here

        @Override
        public long rowCount(Session session) {
            IndexIteration indexIt = newIteration(null, getAIS(session));
            long count = 0;
            Index index;
            while((index = indexIt.next()) != null) {
                count += index.getKeyColumns().size();
            }
            return count;
        }
View Full Code Here

                this.indexIt = newIteration(session, getAIS(session));
            }

            private IndexColumn advance() {
                while(indexColumnIt == null || !indexColumnIt.hasNext()) {
                    Index index = indexIt.next();
                    if(index == null) {
                        return null;
                    }
                    indexColumnIt = index.getKeyColumns().iterator(); // Always at least 1
                }
                return indexColumnIt.next();
            }
View Full Code Here

        int realDepth = (depth != null) ? Math.max(depth, 0) : -1;
        ENTITY_GET.in();
        try (Session session = sessionService.createSession();
             CloseableTransaction txn = transactionService.beginCloseableTransaction(session)) {
            Table table = dxlService.ddlFunctions().getTable(session, tableName);
            Index pkIndex = table.getPrimaryKeyIncludingInternal().getIndex();
            List<List<Object>> pks = PrimaryKeyParser.parsePrimaryKeys(identifiers, pkIndex);
            extDataService.dumpBranchAsJson(session,
                    writer,
                    tableName.getSchemaName(),
                    tableName.getTableName(),
View Full Code Here

        HashMultimap<Integer,Index> tableToIndexes = HashMultimap.create();
        for(Index stub : stubIndexes) {
            // Re-look index up as external API previously only relied on names
            Table table = ais.getTable(stub.getIndexName().getFullTableName());
            String stubName = stub.getIndexName().getName();
            final Index index;
            switch(stub.getIndexType()) {
                case TABLE: index = table.getIndexIncludingInternal(stubName); break;
                case FULL_TEXT: index = table.getFullTextIndex(stubName); break;
                case GROUP: index = table.getGroup().getIndex(stubName); break;
                default:
                    throw new IllegalStateException(stub.getIndexType().toString());
            }
            assert (index != null) : stub;
            for(Integer tid : index.getAllTableIDs()) {
                tableToIndexes.put(tid, index);
            }
        }
        List<ChangeSet> changeSets = new ArrayList<>();
        for(Entry<Integer, Collection<Index>> entry : tableToIndexes.asMap().entrySet()) {
            Table table = ais.getTable(entry.getKey());
            ChangeSet.Builder builder = ChangeSet.newBuilder();
            builder.setChangeLevel(ChangeLevel.INDEX.name());
            builder.setTableId(table.getTableId());
            builder.setOldSchema(table.getName().getSchemaName());
            builder.setOldName(table.getName().getTableName());
            builder.setNewSchema(table.getName().getSchemaName());
            builder.setNewName(table.getName().getTableName());
            for(Index index : entry.getValue()) {
                TableChanges.IndexChange.Builder indexChange = TableChanges.IndexChange.newBuilder();
                indexChange.setChange(ChangeSetHelper.createAddChange(index.getIndexName().getName()));
                indexChange.setIndexType(index.getIndexType().name());
                builder.addIndexChange(indexChange);
            }
            changeSets.add(builder.build());
        }
        return changeSets;
View Full Code Here

            current.clear();
        }

        @Override
        public void visit(Index index) {
            Index prev = current.put(index.getIndexId(), index);
            IndexName name = index.getIndexName();
            if(prev != null) {
                failures.reportFailure(new AISValidationFailure(new DuplicateIndexIdException(prev.getIndexName(), name)));
            }
            Integer indexID = index.getIndexId();
            if((indexID == null) || (indexID <= 0)) {
                failures.reportFailure(new AISValidationFailure(new InvalidIndexIDException(name, indexID)));
            }
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.