Package com.foundationdb.qp.row

Examples of com.foundationdb.qp.row.IndexRow


        // Only set if parent row is looked up
        int i2hPosition = 0;
        IndexToHKey indexToHKey = null;
        SDType parentStoreData = null;
        IndexRow parentPKIndexRow = null;

        // All columns of all segments of the HKey
        for(HKeySegment hKeySegment : table.hKey().segments()) {
            // Ordinal for this segment
            RowDef segmentRowDef = hKeySegment.table().rowDef();
            hKeyAppender.append(segmentRowDef.table().getOrdinal());
            // Segment's columns
            for(HKeyColumn hKeyColumn : hKeySegment.columns()) {
                Table hKeyColumnTable = hKeyColumn.column().getTable();
                if(hKeyColumnTable != table) {
                    // HKey column from row of parent table
                    if (parentStoreData == null) {
                        // Initialize parent metadata and state
                        RowDef parentRowDef = rowDef.table().getParentTable().rowDef();
                        TableIndex parentPkIndex = parentRowDef.getPKIndex();
                        indexToHKey = parentPkIndex.indexToHKey();
                        parentStoreData = createStoreData(session, parentPkIndex);
                        parentPKIndexRow = readIndexRow(session, parentPkIndex, parentStoreData, rowDef, rowData);
                        i2hPosition = hKeyColumn.positionInHKey();
                    }
                    if(indexToHKey.isOrdinal(i2hPosition)) {
                        assert indexToHKey.getOrdinal(i2hPosition) == segmentRowDef.table().getOrdinal() : hKeyColumn;
                        ++i2hPosition;
                    }
                    if(parentPKIndexRow != null) {
                        parentPKIndexRow.appendFieldTo(indexToHKey.getIndexRowPosition(i2hPosition), hKeyAppender.key());
                    } else {
                        // Orphan row
                        hKeyAppender.appendNull();
                    }
                    ++i2hPosition;
View Full Code Here


        Cursor cursor = cursor(plan, queryContext, queryBindings);
        cursor.openTopLevel();
        Row row;
        int count = 0;
        while ((row = cursor.next()) != null) {
            IndexRow indexRow = (IndexRow) row;
            long x = getLong(indexRow, 0);
            long id = getLong(indexRow, 2);
            assertEquals(id, x * 1000);
            switch((int)x) {
                case 1:
View Full Code Here

        Cursor cursor = cursor(indexScan_Default(xyIndexRowType, true), queryContext, queryBindings);
        cursor.openTopLevel();
        Row row;
        final long NEW_Y_VALUE = 99;
        while ((row = cursor.next()) != null) {
            IndexRow indexRow = (IndexRow) row;
            long x = getLong(indexRow, 0);
            long id = getLong(indexRow, 2);
            int pos = 1;
            if (isNull(indexRow, pos)) {
                Row oldRow = row(t, id, x, null);
                Row newRow = row(t, id, x, NEW_Y_VALUE);
                updateRow(oldRow, newRow);
            }
        }
        cursor.close();
        // Check final state
        cursor = cursor(indexScan_Default(xyIndexRowType), queryContext, queryBindings);
        cursor.openTopLevel();
        int count = 0;
        while ((row = cursor.next()) != null) {
            IndexRow indexRow = (IndexRow) row;
            long x = getLong(indexRow, 0);
            long y = getLong(indexRow, 1);
            long id = getLong(indexRow, 2);
            assertEquals(id, x * 1000);
            if (id <= 2000) {
View Full Code Here

    protected boolean beforeStart(Row row)
    {
        boolean beforeStart = false;
        if (startKey != null && row != null && startBoundColumns != 0) {
            IndexRow current = (IndexRow) row;
            int c = current.compareTo(startKey, startBoundColumns) * direction;
            beforeStart = c < 0 || c == 0 && !startInclusive;
        }
        return beforeStart;
    }
View Full Code Here

    {
        boolean pastEnd;
        if (endKey == null || endBoundColumns == 0) {
            pastEnd = false;
        } else {
            IndexRow current = (IndexRow) row;
            int c = current.compareTo(endKey, endBoundColumns) * direction;
            pastEnd = c > 0 || c == 0 && !endInclusive;
        }
        return pastEnd;
    }
View Full Code Here

    private static class AdapterPool
    {
        public IndexRow takeIndexRow(IndexRowType indexRowType)
        {
            IndexRow indexRow = null;
            Deque<IndexRow> indexRows = indexRowCache.get(indexRowType);
            if (indexRows != null && !indexRows.isEmpty()) {
                indexRow = indexRows.removeLast();
                indexRow.reset();
            }
            if (indexRow == null) {
                indexRow = adapter.newIndexRow(indexRowType);
            }
            return indexRow;
View Full Code Here

            // Swap for DESC (only last column matters as they must match until then)
            if(!ascending[f]) {
                startInclusive = keyRange.hiInclusive();
                endInclusive = keyRange.loInclusive();
                IndexRow tmpKey = startKey;
                startKey = endKey;
                endKey = tmpKey;
            }
        }
    }
View Full Code Here

    {
        boolean beforeStart;
        if (startKey == null || row == null || startUnbounded()) {
            beforeStart = false;
        } else {
            IndexRow current = (IndexRow) row;
            int c = current.compareTo(startKey, startBoundColumns, ascending);
            beforeStart = c < 0 || c == 0 && !startInclusive;
        }
        return beforeStart;
    }
View Full Code Here

    {
        boolean pastEnd;
        if (endKey == null || endUnbounded()) {
            pastEnd = false;
        } else {
            IndexRow current = (IndexRow) row;
            int c = current.compareTo(endKey, endBoundColumns, ascending);
            pastEnd = c > 0 || c == 0 && !endInclusive;
        }
        return pastEnd;
    }
View Full Code Here

    //

    @Override
    public Row row() {
        assert (storeData.rawKey != null) : "Called for chopped key (or before iterating)"; // See advanceLogical() for former
        IndexRow row = adapter.takeIndexRow(rowType);
        // updateKey() called from advance
        updateValue();
        row.copyFrom(storeData.persistitKey, storeData.persistitValue);
        return row;
    }
View Full Code Here

TOP

Related Classes of com.foundationdb.qp.row.IndexRow

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.