Package com.foundationdb.ais.model

Examples of com.foundationdb.ais.model.IndexRowComposition


    protected boolean hasNullIndexSegments(RowData rowData, Index index)
    {
        assert index.leafMostTable().rowDef().getRowDefId() == rowData.getRowDefId();
        int nkeys = index.getKeyColumns().size();
        IndexRowComposition indexRowComposition = index.indexRowComposition();
        for (int i = 0; i < nkeys; i++) {
            int fi = indexRowComposition.getFieldPosition(i);
            if (rowData.isNull(fi)) {
                return true;
            }
        }
        return false;
View Full Code Here


        int fields = oldRowDef.getFieldCount();
        // Find the PK and FK fields
        BitSet keyField = new BitSet(fields);
        TableIndex pkIndex = oldRowDef.getPKIndex();
        int nkeys = pkIndex.getKeyColumns().size();
        IndexRowComposition indexRowComposition = pkIndex.indexRowComposition();
        for (int i = 0; i < nkeys; i++) {
            int pkFieldPosition = indexRowComposition.getFieldPosition(i);
            keyField.set(pkFieldPosition, true);
        }
        for (int fkFieldPosition : oldRowDef.getParentJoinFields()) {
            keyField.set(fkFieldPosition, true);
        }
View Full Code Here

                             RowDef newRowDef,
                             RowData newRow,
                             Key hKey,
                             WriteIndexRow indexRowBuffer) {
        int nkeys = index.getKeyColumns().size();
        IndexRowComposition indexRowComposition = index.indexRowComposition();
        if(!fieldsEqual(oldRowDef, oldRow, newRowDef, newRow, nkeys, indexRowComposition)) {
            UPDATE_INDEX_TAP.in();
            try {
                long oldZValue = -1;
                long newZValue = -1;
View Full Code Here

    }

    public void initialize(RowData rowData, Key hKey, SpatialColumnHandler spatialColumnHandler, long zValue) {
        pKeyAppends = 0;
        int indexField = 0;
        IndexRowComposition indexRowComp = index.indexRowComposition();
        FieldDef[] fieldDefs = index.leafMostTable().rowDef().getFieldDefs();
        RowDataSource rowDataValueSource = new RowDataValueSource();
        while (indexField < indexRowComp.getLength()) {
            // handleSpatialColumn will increment pKeyAppends once for all spatial columns
            if (spatialColumnHandler != null && spatialColumnHandler.handleSpatialColumn(this, indexField, zValue)) {
                if (indexField == index.firstSpatialArgument()) {
                    pKeyAppends++;
                }
            } else {
                if (indexRowComp.isInRowData(indexField)) {
                    FieldDef fieldDef = fieldDefs[indexRowComp.getFieldPosition(indexField)];
                    Column column = fieldDef.column();
                    rowDataValueSource.bind(fieldDef, rowData);
                    pKeyTarget().append(rowDataValueSource,
                                        column.getType());
                } else if (indexRowComp.isInHKey(indexField)) {
                    PersistitKey.appendFieldFromKey(pKey(), hKey, indexRowComp.getHKeyPosition(indexField), index
                        .getIndexName());
                } else {
                    throw new IllegalStateException("Invalid IndexRowComposition: " + indexRowComp);
                }
                pKeyAppends++;
View Full Code Here

    public void testIndexMetadata()
    {
        // Index row: e.uid, m.lastLogin, m.profileID, e.eugid
        // HKey for eug table: [U, e.uid, M, E, e.eugid]
        GroupIndex gi = (GroupIndex) groupIndexRowType.index();
        IndexRowComposition rowComposition = gi.indexRowComposition();
        assertEquals(4, rowComposition.getFieldPosition(0));
        assertEquals(2, rowComposition.getFieldPosition(1));
        assertEquals(1, rowComposition.getFieldPosition(2));
        assertEquals(3, rowComposition.getFieldPosition(3));
    }
View Full Code Here

        }
        int firstSpatialColumn = groupIndex.isSpatial() ? groupIndex.firstSpatialArgument() : -1;
        SDType storeData = store.createStoreData(session, groupIndex);
        try {
            store.resetForWrite(storeData, groupIndex, indexRow);
            IndexRowComposition irc = groupIndex.indexRowComposition();
            int nFields = irc.getLength();
            int f = 0;
            while(f < nFields) {
                assert irc.isInRowData(f);
                assert ! irc.isInHKey(f);
                if(f == firstSpatialColumn) {
                    copyZValueToIndexRow(groupIndex, row, irc);
                    f += groupIndex.dimensions();
                } else {
                    copyFieldToIndexRow(groupIndex, row, irc.getFieldPosition(f++));
                }
            }
            // Non-null values only required for UNIQUE indexes, which GIs cannot be
            assert !groupIndex.isUnique() : "Unexpected unique index: " + groupIndex;
            indexRow.close(null, null, false);
View Full Code Here

TOP

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

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.