Package com.foundationdb.server.api.dml.scan

Examples of com.foundationdb.server.api.dml.scan.LegacyRowWrapper



    protected final IndexStatistics decodeIndexStatisticsRow(RowData rowData,
                                                             RowDef indexStatisticsRowDef,
                                                             Index index) {
        LegacyRowWrapper row = new LegacyRowWrapper(indexStatisticsRowDef, rowData);

        long analysisTimestamp = ((Integer)row.get(ANALYSIS_TIMESTAMP_FIELD_INDEX)).longValue();
        long rowCount = (Long)row.get(ROW_COUNT_FIELD_INDEX);
        long sampledCount = (Long)row.get(SAMPLED_COUNT_FIELD_INDEX);

        IndexStatistics result = new IndexStatistics(index);
        result.setAnalysisTimestamp(analysisTimestamp * 1000);
        result.setRowCount(rowCount);
        result.setSampledCount(sampledCount);
View Full Code Here


    }

    protected final void decodeIndexStatisticsEntryRow(RowData rowData,
                                                       RowDef indexStatisticsEntryRowDef,
                                                       IndexStatistics indexStatistics) {
        LegacyRowWrapper row = new LegacyRowWrapper(indexStatisticsEntryRowDef, rowData);

        int columnCount = ((Integer)row.get(COLUMN_COUNT_FIELD_INDEX)).intValue();
        int itemNumber = ((Integer)row.get(ITEM_NUMBER_FIELD_INDEX)).intValue();
        String keyString = (String)row.get(KEY_STRING_FIELD_INDEX);

        WrappingByteSource byteSource = (WrappingByteSource)row.get(KEY_BYTES_FIELD_INDEX);
        byte[] keyBytes = byteSource.toByteSubarray();

        long eqCount = (Long)row.get(EQ_COUNT_FIELD_INDEX);
        long ltCount = (Long)row.get(LT_COUNT_FIELD_INDEX);
        long distinctCount = (Long)row.get(DISTINCT_COUNT_FIELD_INDEX);

        int firstColumn = 0; // Correct for multi-column
        if (columnCount < 0) {
            firstColumn = -columnCount - 1;
            columnCount = 1;
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

    protected static RowData mergeRows(RowDef oldRowDef, RowData currentRow, RowDef newRowDef, RowData newRowData, ColumnSelector selector) {
        if(selector == null || selector == ConstantColumnSelector.ALL_ON) {
            return newRowData;
        }
        NewRow mergedRow = NiceRow.fromRowData(currentRow, oldRowDef);
        NewRow newRow = new LegacyRowWrapper(newRowDef, newRowData);
        int fields = oldRowDef.getFieldCount();
        for(int i = 0; i < fields; i++) {
            if(selector.includesColumn(i)) {
                mergedRow.put(i, newRow.get(i));
            }
        }
        return mergedRow.toRowData();
    }
View Full Code Here

        }
    }

    private boolean selectedIndex(RowDef rowDef, RowData rowData, long tableId, long indexId)
    {
        LegacyRowWrapper row = new LegacyRowWrapper(rowDef, rowData);
        long rowTableId = (Long) row.get(0);
        long rowIndexId = (Long) row.get(1);
        return rowTableId == tableId && rowIndexId == indexId;
    }
View Full Code Here

        // Insert longs, not integers, because Persistit stores all ints as 8-byte.
        niceRow.put(cId, 100);
        niceRow.put(cA, 200);
        niceRow.put(cB, 300);
        niceRow.put(cC, null);
        LegacyRowWrapper legacyRow = new LegacyRowWrapper(niceRow.getRowDef(), niceRow.toRowData());
        assertEquals(100, legacyRow.get(cId));
        assertEquals(200, legacyRow.get(cA));
        assertEquals(300, legacyRow.get(cB));
        assertNull(legacyRow.get(cC));
        legacyRow.put(cA, 222);
        legacyRow.put(cB, null);
        legacyRow.put(cC, 444);
        assertEquals(100, legacyRow.get(cId));
        assertEquals(222, legacyRow.get(cA));
        assertNull(legacyRow.get(cB));
        assertEquals(444, legacyRow.get(cC));
    }
View Full Code Here

        niceRow.put(cId, 0);
        niceRow.put(cA, 0);
        niceRow.put(cB, 0);
        niceRow.put(cC, 0);
        // Create initial legacy row
        LegacyRowWrapper legacyRow = new LegacyRowWrapper(niceRow.getRowDef(), niceRow.toRowData());
        assertEquals(0, legacyRow.get(cA));
        assertEquals(0, legacyRow.get(cB));
        assertEquals(0, legacyRow.get(cC));
        // Apply a few updates
        legacyRow.put(cA, 1);
        legacyRow.put(cB, 1);
        legacyRow.put(cC, 1);
        // Check the updates (should be a NiceRow)
        assertEquals(1, legacyRow.get(cA));
        assertEquals(1, legacyRow.get(cB));
        assertEquals(1, legacyRow.get(cC));
        // Convert to LegacyRow and check NiceRow created from the legacy row's RowData
        RowDef rowDef = getRowDef(t);
        niceRow = (NiceRow) NiceRow.fromRowData(legacyRow.toRowData(), rowDef);
        assertEquals(1, niceRow.get(cA));
        assertEquals(1, niceRow.get(cB));
        assertEquals(1, niceRow.get(cC));
        // Convert back to NiceRow and check state again
        legacyRow.put(cA, 2);
        legacyRow.put(cB, 2);
        legacyRow.put(cC, 2);
        assertEquals(2, legacyRow.get(cA));
        assertEquals(2, legacyRow.get(cB));
        assertEquals(2, legacyRow.get(cC));
    }
View Full Code Here

    }

    public void set(Key key, RowData rowData) {
        this.rowData = rowData;
        RowDef rowDef = adapter.schema().ais().getTable(rowData.getRowDefId()).rowDef();
        row = new LegacyRowWrapper(rowDef, rowData);

        currentHKey = hKeyCache.hKey(rowDef.table());
        if(key != null) {
            currentHKey.copyFrom(key);
        }
View Full Code Here

        throw new IllegalStateException("no active row");
    }

    void copyFromExchange(Exchange exchange) throws PersistitException
    {
        this.row = new LegacyRowWrapper((RowDef) null);
        RuntimeException exception;
        do {
            try {
                exception = null;
                adapter.persistit().expandRowData(adapter.getSession(), exchange, rowData);
View Full Code Here

TOP

Related Classes of com.foundationdb.server.api.dml.scan.LegacyRowWrapper

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.