Package com.foundationdb.qp.row

Examples of com.foundationdb.qp.row.HKey


        Key pkKey = testCreator.createKey();
        pkKey.append(15L);
        pkKey.append(7L);
        pkKey.append(5L);
        row.copyFrom (pkKey, null);
        HKey hkey = row.ancestorHKey(items);
       
        assertNotNull (hkey);
        assertEquals(hkey.value(0).getInt64(), 7L);
        assertEquals(hkey.value(1).getInt64(), 5L);
        assertEquals(hkey.value(2).getInt64(), 15L);
    }
View Full Code Here


    }

    /* Allocate a new <code>HKey</code> and copy the given
     * key bytes into it. */
    protected Row toHkeyRow(String encoded) {
        HKey hkey = context.getStore().newHKey(rowType.hKey());
        Key key = context.getStore().createKey();
        byte decodedBytes[] = RowIndexer.decodeString(encoded);
        key.setEncodedSize(decodedBytes.length);
        System.arraycopy(decodedBytes, 0, key.getEncodedBytes(), 0, decodedBytes.length);
        hkey.copyFrom(key);
        return (Row)(ValuesHKey)hkey;
    }
View Full Code Here

        }
    }

    private Row toHKeyRow(byte rowBytes[], HKeyRowType hKeyRowType, StoreAdapter store)
    {
        HKey hkey = store.newHKey(hKeyRowType.hKey());
        Key key = store.createKey();
       
        key.setEncodedSize(rowBytes.length);
        System.arraycopy(rowBytes, 0, key.getEncodedBytes(), 0, rowBytes.length);
       
        hkey.copyFrom(key);
       
        if (hkey instanceof ValuesHKey) {
            return ((Row)(ValuesHKey)hkey);
        } else {
            throw new UnsupportedOperationException("HKey type is not ValuesHKey");
View Full Code Here

        try {
            Key hKey = getKey(session, storeData);
            constructHKey(session, table.rowDef(), rowData, hKey);

            StoreAdapter adapter = createAdapter(session, SchemaCache.globalSchema(table.getAIS()));
            HKey persistitHKey = adapter.newHKey(table.hKey());
            persistitHKey.copyFrom(hKey);

            for(GroupIndex groupIndex : groupIndexes) {
                if(columnDifferences == null || groupIndex.columnsOverlap(table, columnDifferences)) {
                    StoreGIMaintenance plan = StoreGIMaintenancePlans
                            .forAis(table.getAIS())
View Full Code Here

    }
   
    @Override
    public HKey ancestorHKey(Table table)
    {
        HKey ancestorHKey;
       
        IndexToHKey indexToHKey;
        if (index.isGroupIndex()) {
            ancestorHKey = keyCreator.newHKey(table.hKey());
            indexToHKey = ((GroupIndex)index).indexToHKey(table.getDepth());
        } else {
            ancestorHKey = keyCreator.newHKey(index.leafMostTable().hKey());
            indexToHKey = ((TableIndex)index).indexToHKey();
        }
       
       
        Key hKey = keyCreator.createKey();
        hKey.clear();
        for (int i = 0; i < indexToHKey.getLength(); i++) {
            if (indexToHKey.isOrdinal(i)) {
                hKey.append(indexToHKey.getOrdinal(i));
            } else {
                int indexField = indexToHKey.getIndexRowPosition(i);
                if (index.isSpatial()) {
                    // A spatial index has a single key column (the z-value), representing the declared spatial key columns.
                    if (indexField > index.firstSpatialArgument())
                        indexField -= index.dimensions() - 1;
                }
                Key keySource = iKey;
                if (indexField < 0 || indexField > keySource.getDepth()) {
                    throw new IllegalStateException(String.format("keySource: %s, indexField: %s",
                                                                  keySource, indexField));
                }
                PersistitKey.appendFieldFromKey(hKey, keySource, indexField, index.getIndexName());
            }
        }
        ancestorHKey.copyFrom(hKey);
        if (index.isTableIndex() && index.leafMostTable() != table) {
            this.leafTableHKey = ancestorHKey;
            ancestorHKey = keyCreator.newHKey(table.hKey());
            this.leafTableHKey.copyTo(ancestorHKey);
            ancestorHKey.useSegments(table.getDepth() + 1);
        }
        return ancestorHKey;
    }
View Full Code Here

    // Row interface

    @Override
    public HKey ancestorHKey(Table table)
    {
        HKey ancestorHKey = hKeyCache.hKey(table);
        Key hKey = keyCreator.createKey();
        constructHKeyFromIndexKey(hKey, index.indexToHKey(table.getDepth()));
        ancestorHKey.copyFrom(hKey);
        return ancestorHKey;
    }
View Full Code Here

    // Row interface

    @Override
    public HKey ancestorHKey(Table table)
    {
        HKey ancestorHKey;
        HKey leafmostHKey = hKeyCache.hKey(leafmostTable);
        if (table == leafmostTable) {
            ancestorHKey = leafmostHKey;
        } else {
            ancestorHKey = hKeyCache.hKey(table);
            leafmostHKey.copyTo(ancestorHKey);
            ancestorHKey.useSegments(table.getDepth() + 1);
        }
        return ancestorHKey;
    }
View Full Code Here

    }

    @Override
    public HKey ancestorHKey(Table table)
    {
        HKey ancestorHKey = hKeyCache.hKey(table);
        currentHKey.copyTo(ancestorHKey);
        ancestorHKey.useSegments(table.getDepth() + 1);
        return ancestorHKey;
    }
View Full Code Here

    }

    @Override
    public HKey ancestorHKey(Table table)
    {
        HKey ancestorHKey = hKeyCache.hKey(table);
        currentHKey.copyTo(ancestorHKey);
        ancestorHKey.useSegments(table.getDepth() + 1);
        return ancestorHKey;
    }
View Full Code Here

                exception = null;
                adapter.persistit().expandRowData(adapter.getSession(), exchange, rowData);
                RowDef rowDef = adapter.schema().ais().getTable(rowData.getRowDefId()).rowDef();
                row.setRowDef(rowDef);
                row.setRowData(rowData);
                HKey persistitHKey = persistitHKey();
                persistitHKey.copyFrom(exchange.getKey());
            } catch (ArrayIndexOutOfBoundsException e) {
                exception = e;
            } catch (EncodingException e) {
                if (e.getCause() instanceof ArrayIndexOutOfBoundsException) {
                    exception = e;
View Full Code Here

TOP

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

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.