Package com.foundationdb.server.rowdata

Examples of com.foundationdb.server.rowdata.RowDef


        return result;
    }

    @Override
    public void removeStatistics(Session session, Index index) {
        RowDef indexRowDef = index.leafMostTable().rowDef();
        RowDef indexStatisticsRowDef = getIndexStatsRowDef(session);

        Key hKey = getStore().createKey();
        hKey.append(indexStatisticsRowDef.table().getOrdinal())
                .append((long) indexRowDef.getRowDefId())
                .append((long) index.getIndexId());

        FDBStoreData storeData = getStore().createStoreData(session, indexStatisticsRowDef.getGroup());
        hKey.copyTo(storeData.persistitKey);
        getStore().groupKeyAndDescendantsIterator(session, storeData, false);
        while(storeData.next()) {
            RowData rowData = new RowData();
            FDBStoreDataHelper.expandRowData(rowData, storeData, false);
View Full Code Here


    }

    /** Store statistics into database. */
    public final void storeIndexStatistics(Session session, Index index, IndexStatistics indexStatistics) {
        int tableId = index.leafMostTable().rowDef().getRowDefId();
        RowDef indexStatisticsRowDef = getIndexStatsRowDef(session);
        RowDef indexStatisticsEntryRowDef = getIndexStatsEntryRowDef(session);

        // Remove existing statistics for the index
        removeStatistics(session, index);

        // Parent header row.
View Full Code Here

    }

    @Override
    public void packRowData(FDBStore store, Session session,
                            FDBStoreData storeData, RowData rowData) {
        RowDef rowDef = rowDefFromId(((Group)object).getRoot(), rowData.getRowDefId());
        if (rowDef == null) {
            throw new AkibanInternalException("Cannot find table " + rowData);
        }
        RowDataValueSource valueSource = new RowDataValueSource();
        int nfields = rowDef.getFieldCount();
        Map<String,Object> value = new HashMap<>(nfields); // Intermediate form of value.
        for (int i = 0; i < nfields; i++) {
            FieldDef fieldDef = rowDef.getFieldDef(i);
            valueSource.bind(fieldDef, rowData);
            value.put(fieldDef.getName(), ValueSources.toObject(valueSource));
        }
        storeData.otherValue = value;
    }
View Full Code Here

    private static RowDef rowDefFromId(Table table, int tableId) {
        if (table.getTableId() == tableId) {
            return table.rowDef();
        }
        for (Join join : table.getChildJoins()) {
            RowDef rowDef = rowDefFromId(join.getChild(), tableId);
            if (rowDef != null) {
                return rowDef;
            }
        }
        return null;
View Full Code Here

    @Override
    @SuppressWarnings("unchecked")
    public void expandRowData(FDBStore store, Session session,
                              FDBStoreData storeData, RowData rowData) {
        Map<String,Object> value = (Map<String,Object>)storeData.otherValue;
        RowDef rowDef = TupleStorageDescription.rowDefFromOrdinals((Group)object, storeData);
        assert (rowDef != null) : storeData.persistitKey;
        int nfields = rowDef.getFieldCount();
        Object[] objects = new Object[nfields];
        for (int i = 0; i < nfields; i++) {
            objects[i] = value.get(rowDef.getFieldDef(i).getName());
        }
        if (rowData.getBytes() == null) {
            rowData.reset(new byte[RowData.CREATE_ROW_INITIAL_SIZE]);
        }
        rowData.createRow(rowDef, objects, true);
View Full Code Here

            }
        }
    }

    public void visit(Key key, RowData rowData) {
        RowDef rowDef = store.getAIS(session).getTable(rowData.getRowDefId()).rowDef();
        Object[] keyObjs = key(key, rowDef);
        NewRow newRow = new LegacyRowWrapper(rowDef, rowData);
        visit(keyObjs, newRow);
    }
View Full Code Here

    @Override
    public void packRowData(FDBStore store, Session session,
                            FDBStoreData storeData, RowData rowData) {
        if (usage == TupleUsage.KEY_AND_ROW) {
            RowDef rowDef = object.getAIS().getTable(rowData.getRowDefId()).rowDef();
            Tuple2 t = TupleRowDataConverter.tupleFromRowData(rowDef, rowData);
            storeData.rawValue = t.pack();
        }
        else {
            super.packRowData(store, session, storeData, rowData);
View Full Code Here

    @Override
    public void expandRowData(FDBStore store, Session session,
                              FDBStoreData storeData, RowData rowData) {
        if (usage == TupleUsage.KEY_AND_ROW) {
            Tuple2 t = Tuple2.fromBytes(storeData.rawValue);
            RowDef rowDef = rowDefFromOrdinals((Group) object, storeData);
            TupleRowDataConverter.tupleToRowData(t, rowDef, rowData);
        }
        else {
            super.expandRowData(store, session, storeData, rowData);
        }
View Full Code Here

    }

    @Override
    public void removeStatistics(Session session, Index index) {
        try {
            RowDef indexStatisticsRowDef = getIndexStatsRowDef(session);
            Exchange exchange = getStore().getExchange(session, indexStatisticsRowDef);
            removeStatisticsInternal(session, index, exchange);
        } catch(PersistitException | RollbackException e) {
            throw PersistitAdapter.wrapPersistitException(session, e);
        }
View Full Code Here

    //
    // Internal
    //

    private IndexStatistics loadIndexStatisticsInternal(Session session, Index index) throws PersistitException {
        RowDef indexRowDef = index.leafMostTable().rowDef();
        RowDef indexStatisticsRowDef = getIndexStatsRowDef(session);
        RowDef indexStatisticsEntryRowDef = getIndexStatsEntryRowDef(session);

        Exchange exchange = getStore().getExchange(session, indexStatisticsRowDef);
        exchange.clear()
            .append(indexStatisticsRowDef.table().getOrdinal())
            .append((long)indexRowDef.getRowDefId())
View Full Code Here

TOP

Related Classes of com.foundationdb.server.rowdata.RowDef

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.