Search in sources :

Example 86 with ByteIterator

use of com.yahoo.ycsb.ByteIterator in project voltdb by VoltDB.

the class VoltClient4 method packRowData.

private byte[] packRowData(HashMap<String, ByteIterator> columns) {
    m_writeBuf.clear();
    m_writeBuf.putInt(columns.size());
    for (String key : columns.keySet()) {
        byte[] k = key.getBytes(UTF8);
        m_writeBuf.putInt(k.length);
        m_writeBuf.put(k);
        ByteIterator v = columns.get(key);
        int len = (int) v.bytesLeft();
        m_writeBuf.putInt(len);
        v.nextBuf(m_workingData, m_writeBuf.position());
        m_writeBuf.position(m_writeBuf.position() + len);
    }
    byte[] data = new byte[m_writeBuf.position()];
    System.arraycopy(m_workingData, 0, data, 0, data.length);
    return data;
}
Also used : ByteArrayByteIterator(com.yahoo.ycsb.ByteArrayByteIterator) ByteIterator(com.yahoo.ycsb.ByteIterator)

Example 87 with ByteIterator

use of com.yahoo.ycsb.ByteIterator in project voltdb by VoltDB.

the class VoltClient4 method unpackRowData.

private HashMap<String, ByteIterator> unpackRowData(VoltTable data, Set<String> fields) {
    byte[] rowData = data.getVarbinary(0);
    ByteBuffer buf = ByteBuffer.wrap(rowData);
    int nFields = buf.getInt();
    int size = fields != null ? Math.min(fields.size(), nFields) : nFields;
    HashMap<String, ByteIterator> res = new HashMap<String, ByteIterator>(size, (float) 1.25);
    return unpackRowData(rowData, buf, nFields, fields, res);
}
Also used : ByteArrayByteIterator(com.yahoo.ycsb.ByteArrayByteIterator) ByteIterator(com.yahoo.ycsb.ByteIterator) HashMap(java.util.HashMap) ByteBuffer(java.nio.ByteBuffer)

Aggregations

ByteIterator (com.yahoo.ycsb.ByteIterator)87 HashMap (java.util.HashMap)70 StringByteIterator (com.yahoo.ycsb.StringByteIterator)52 Status (com.yahoo.ycsb.Status)33 ByteArrayByteIterator (com.yahoo.ycsb.ByteArrayByteIterator)30 Test (org.junit.Test)30 DBException (com.yahoo.ycsb.DBException)20 Map (java.util.Map)14 IOException (java.io.IOException)8 EntityProperty (com.microsoft.azure.storage.table.EntityProperty)5 Vector (java.util.Vector)5 BaseDocument (com.arangodb.entity.BaseDocument)4 DynamicTableEntity (com.microsoft.azure.storage.table.DynamicTableEntity)4 DB (com.yahoo.ycsb.DB)4 ByteBuffer (java.nio.ByteBuffer)4 ArrayList (java.util.ArrayList)4 Put (org.apache.hadoop.hbase.client.Put)4 MongoCollection (com.allanbank.mongodb.MongoCollection)3 DocumentBuilder (com.allanbank.mongodb.bson.builder.DocumentBuilder)3 ArangoDBException (com.arangodb.ArangoDBException)3