Package com.foundationdb.ais.model

Examples of com.foundationdb.ais.model.Table


            super.expandRowData(store, session, storeData, rowData);
        }
    }

    public static RowDef rowDefFromOrdinals(Group group, FDBStoreData storeData) {
        Table root = group.getRoot();
        Key hkey = storeData.persistitKey;
        hkey.reset();
        int ordinal = hkey.decodeInt();
        assert (root.getOrdinal() == ordinal) : hkey;
        Table table = root;
        int index = 0;
        while (true) {
            int[] keyDepth = table.hKey().keyDepth();
            index = keyDepth[keyDepth.length - 1];
            if (index >= hkey.getDepth()) {
                return table.rowDef();
            }
            hkey.indexTo(index);
            ordinal = hkey.decodeInt();
            boolean found = false;
            for (Join join : table.getChildJoins()) {
                table = join.getChild();
                if (table.getOrdinal() == ordinal) {
                    found = true;
                    break;
                }
            }
            if (!found) {
View Full Code Here


        checkChanges(ChangeLevel.INDEX, state.tableIndexChanges, oldIndexes, newIndexes, true);
    }

    private void compareGroupIndexes() {
        final Set<Table> keepTables = new HashSet<>();
        final Table traverseStart;
        if(parentChange == ParentChange.DROP) {
            traverseStart = oldTable;
        } else {
           traverseStart = oldTable.getGroup().getRoot();
        }

        traverseStart.visit(new AbstractVisitor() {
            @Override
            public void visit(Table table) {
                keepTables.add(table);
            }
        });
View Full Code Here

            }
        }

        Collection<Join> oldChildJoins = new ArrayList<>(oldTable.getCandidateChildJoins());
        for(Join join : oldChildJoins) {
            Table oldChildTable = join.getChild();

            // If referenced column has anymore has a TABLE change (or is missing), join needs dropped
            boolean dropParent = false;
            for(JoinColumn joinCol : join.getJoinColumns()) {
                Column oldColumn = joinCol.getParent().getColumn();
View Full Code Here

            }
        }
        // TODO: Would be nice to track complete details (e.g. constraint name) instead of just table
        for(TableName refName : referencedChanges) {
            if(!state.hasOldTable(refName)) {
                Table table = oldTable.getAIS().getTable(refName);
                TableName parentName = (table.getParentJoin() != null) ? table.getParentJoin().getParent().getName() : null;
                trackChangedTable(table, ParentChange.NONE, parentName, null, true);
            }
        }
        if(!referencedChanges.isEmpty()) {
            switch(finalChangeLevel) {
View Full Code Here

        }
        if(oldJoin == null /*&& newJoin != null*/) {
            return ParentChange.ADD;
        }

        Table oldParent = oldJoin.getParent();
        Table newParent = newJoin.getParent();
        if(!oldParent.getName().equals(newParent.getName()) ||
           (oldJoin.getJoinColumns().size() != newJoin.getJoinColumns().size())) {
            return ParentChange.ADD;
        }

        boolean sawRename = false;
View Full Code Here

    // NOTE: Should only be used during debugging via Persistit tools.
    public Object get(Value value, Class<?> clazz, CoderContext context) throws ConversionException {
        int pos = value.getCursor();
        int tableId = Util.getInt(value.getEncodedBytes(), pos);
        pos += 4;
        Table root = RowDefBuilder.LATEST_FOR_DEBUGGING.getTable(tableId);
        if (root != null) {
            StorageDescription storage = root.getGroup().getStorageDescription();
            if (storage instanceof PersistitProtobufStorageDescription) {
                ProtobufRowDataConverter converter = ((PersistitProtobufStorageDescription)storage).ensureConverter();
                PersistitProtobufRow holder = new PersistitProtobufRow(converter, null);
                try {
                    render(value, holder, clazz, context);
View Full Code Here

        }
        else {
            IndexStatistics stats = cache.get(index);
            if ((stats != null) && stats.isInvalid() && !stats.isWarned()) {
                if (index.isTableIndex()) {
                    Table table = ((TableIndex)index).getTable();
                    log.warn("No statistics for table {}; cost estimates will not be accurate", table.getName());
                    stats.setWarned(true);
                    backgroundState.offer(table);
                }
                else {
                    log.warn("No statistics for index {}; cost estimates will not be accurate", index.getIndexName());
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) {
                    Group group = ais.getGroup(indexName.getFullTableName());
                    if (group != null)
                        index = group.getIndex(indexName.getName());
                }
View Full Code Here

        switch(index.getIndexType()) {
            case TABLE:
                tableName = ((TableIndex)index).getTable().getName();
            break;
            case GROUP:
                Table root = ((GroupIndex)index).getGroup().getRoot();
                if(root == null) {
                    throw new IllegalArgumentException("Grouping incomplete (no root)");
                }
                tableName = root.getName();
            break;
            case FULL_TEXT:
                tableName = ((FullTextIndex)index).getIndexedTable().getName();
            break;
            default:
View Full Code Here

            tableConvertersByTableId = new HashMap<>(tablesByUuid.size());
            groupFieldsByTabelId = new HashMap<>(tablesByUuid.size());
            tableConvertersByField = new HashMap<>(tablesByUuid.size());
            for (FieldDescriptor field : groupMessage.getFields()) {
                String uuid = field.getOptions().getExtension(ColumnOptions.fdbsql).getUuid();
                Table table = tablesByUuid.get(uuid);
                if (table != null) {
                    ProtobufRowDataConverter converter = new TableConverter(table, field.getMessageType());
                    tableConvertersByTableId.put(table.getTableId(), converter);
                    groupFieldsByTabelId.put(table.getTableId(), field);
                    tableConvertersByField.put(field, converter);
                }
            }
        }
View Full Code Here

TOP

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

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.