Search in sources :

Example 1 with KeyValue

use of org.apache.accumulo.core.data.KeyValue in project accumulo by apache.

the class IteratorAdapter method next.

@Override
public Entry<Key, Value> next() {
    try {
        Entry<Key, Value> result = new KeyValue(new Key(inner.getTopKey()), new Value(inner.getTopValue()).get());
        inner.next();
        return result;
    } catch (IOException ex) {
        throw new NoSuchElementException();
    }
}
Also used : KeyValue(org.apache.accumulo.core.data.KeyValue) KeyValue(org.apache.accumulo.core.data.KeyValue) Value(org.apache.accumulo.core.data.Value) IOException(java.io.IOException) Key(org.apache.accumulo.core.data.Key) NoSuchElementException(java.util.NoSuchElementException)

Example 2 with KeyValue

use of org.apache.accumulo.core.data.KeyValue in project accumulo by apache.

the class AccumuloRowInputFormatIT method prepareRows.

@BeforeClass
public static void prepareRows() {
    row1 = new ArrayList<>();
    row1.add(new KeyValue(new Key(ROW1, COLF1, "colq1"), "v1".getBytes()));
    row1.add(new KeyValue(new Key(ROW1, COLF1, "colq2"), "v2".getBytes()));
    row1.add(new KeyValue(new Key(ROW1, "colf2", "colq3"), "v3".getBytes()));
    row2 = new ArrayList<>();
    row2.add(new KeyValue(new Key(ROW2, COLF1, "colq4"), "v4".getBytes()));
    row3 = new ArrayList<>();
    row3.add(new KeyValue(new Key(ROW3, COLF1, "colq5"), "v5".getBytes()));
}
Also used : KeyValue(org.apache.accumulo.core.data.KeyValue) Key(org.apache.accumulo.core.data.Key) BeforeClass(org.junit.BeforeClass)

Example 3 with KeyValue

use of org.apache.accumulo.core.data.KeyValue in project accumulo by apache.

the class OfflineIterator method next.

@Override
public Entry<Key, Value> next() {
    try {
        byte[] v = iter.getTopValue().get();
        // copy just like tablet server does, do this before calling next
        KeyValue ret = new KeyValue(new Key(iter.getTopKey()), Arrays.copyOf(v, v.length));
        iter.next();
        while (iter != null && !iter.hasTop()) nextTablet();
        return ret;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : KeyValue(org.apache.accumulo.core.data.KeyValue) Key(org.apache.accumulo.core.data.Key) PartialKey(org.apache.accumulo.core.data.PartialKey) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) NotImplementedException(org.apache.commons.lang.NotImplementedException) IOException(java.io.IOException) SampleNotPresentException(org.apache.accumulo.core.client.SampleNotPresentException) AccumuloException(org.apache.accumulo.core.client.AccumuloException)

Example 4 with KeyValue

use of org.apache.accumulo.core.data.KeyValue in project accumulo-examples by apache.

the class ChunkInputStreamTest method addData.

private static void addData(List<Entry<Key, Value>> data, String row, String cf, int chunkSize, int chunkCount, String vis, String value) {
    Text chunkCQ = new Text(FileDataIngest.intToBytes(chunkSize));
    chunkCQ.append(FileDataIngest.intToBytes(chunkCount), 0, 4);
    data.add(new KeyValue(new Key(new Text(row), new Text(cf), chunkCQ, new Text(vis)), value.getBytes()));
}
Also used : KeyValue(org.apache.accumulo.core.data.KeyValue) Text(org.apache.hadoop.io.Text) Key(org.apache.accumulo.core.data.Key)

Example 5 with KeyValue

use of org.apache.accumulo.core.data.KeyValue in project accumulo by apache.

the class AccumuloRowInputFormatIT method prepareRows.

@BeforeClass
public static void prepareRows() {
    row1 = new ArrayList<>();
    row1.add(new KeyValue(new Key(ROW1, COLF1, "colq1"), "v1".getBytes()));
    row1.add(new KeyValue(new Key(ROW1, COLF1, "colq2"), "v2".getBytes()));
    row1.add(new KeyValue(new Key(ROW1, "colf2", "colq3"), "v3".getBytes()));
    row2 = new ArrayList<>();
    row2.add(new KeyValue(new Key(ROW2, COLF1, "colq4"), "v4".getBytes()));
    row3 = new ArrayList<>();
    row3.add(new KeyValue(new Key(ROW3, COLF1, "colq5"), "v5".getBytes()));
}
Also used : KeyValue(org.apache.accumulo.core.data.KeyValue) Key(org.apache.accumulo.core.data.Key) BeforeClass(org.junit.BeforeClass)

Aggregations

KeyValue (org.apache.accumulo.core.data.KeyValue)8 Key (org.apache.accumulo.core.data.Key)7 IOException (java.io.IOException)2 AccumuloException (org.apache.accumulo.core.client.AccumuloException)2 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)2 SampleNotPresentException (org.apache.accumulo.core.client.SampleNotPresentException)2 PartialKey (org.apache.accumulo.core.data.PartialKey)2 Range (org.apache.accumulo.core.data.Range)2 TKeyValue (org.apache.accumulo.core.data.thrift.TKeyValue)2 Text (org.apache.hadoop.io.Text)2 BeforeClass (org.junit.BeforeClass)2 ArrayList (java.util.ArrayList)1 NoSuchElementException (java.util.NoSuchElementException)1 Instance (org.apache.accumulo.core.client.Instance)1 TableDeletedException (org.apache.accumulo.core.client.TableDeletedException)1 TableNotFoundException (org.apache.accumulo.core.client.TableNotFoundException)1 TableOfflineException (org.apache.accumulo.core.client.TableOfflineException)1 TabletLocation (org.apache.accumulo.core.client.impl.TabletLocator.TabletLocation)1 ThriftSecurityException (org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException)1 Value (org.apache.accumulo.core.data.Value)1