public class FluoKeyValueGenerator extends Object
AccumuloFileOutputFormat inorder to seed an initialized Fluo
table on which no transactions have executed.
This class generates multiple Accumulo key values for a single Fluo row and column. The key values generated are guaranteed to be in sorted order.
This class is designed to be reused inorder to avoid object creation in a map reduce job.
// this could be shared between calls to map or reduce, to avoid creating for each call.
FluoKeyValueGenerator fkvg = new FluoKeyValueGenerator();
// could also reuse column objects.
Column column = new Column("fam1", "fam2");
fkvg.setRow("row1").setColumn(column).setValue("val2");
for (FluoKeyValue fluoKeyValue : fkvg.getKeyValues())
writeToAccumuloFile(fluoKeyValue);
fkvg.setRow("row2").setColumn(column).setValue("val3");
// Each call to getKeyValues() returns the same objects populated with different data when
// possible. So subsequent calls to getKeyValues() will create less objects. Of course this
// invalidates what was returned by previous calls to getKeyValues().
for (FluoKeyValue fluoKeyValue : fkvg.getKeyValues())
writeToAccumuloFile(fluoKeyValue);
| Constructor and Description |
|---|
FluoKeyValueGenerator() |
| Modifier and Type | Method and Description |
|---|---|
FluoKeyValue[] |
getKeyValues()
Translates the Fluo row, column, and value set into the persistent format that is stored in
Accumulo.
|
FluoKeyValueGenerator |
set(RowColumnValue rcv)
Set the row, column, and value
|
FluoKeyValueGenerator |
setColumn(Column col) |
FluoKeyValueGenerator |
setRow(byte[] row) |
FluoKeyValueGenerator |
setRow(Bytes row) |
FluoKeyValueGenerator |
setRow(String row)
This method will use UTF-8 to encode the string as bytes.
|
FluoKeyValueGenerator |
setRow(org.apache.hadoop.io.Text row) |
FluoKeyValueGenerator |
setValue(byte[] val) |
FluoKeyValueGenerator |
setValue(Bytes val) |
FluoKeyValueGenerator |
setValue(String val)
This method will use UTF-8 to encode the string as bytes.
|
FluoKeyValueGenerator |
setValue(org.apache.hadoop.io.Text val) |
public FluoKeyValueGenerator setRow(byte[] row)
public FluoKeyValueGenerator setRow(org.apache.hadoop.io.Text row)
public FluoKeyValueGenerator setRow(Bytes row)
public FluoKeyValueGenerator setRow(String row)
public FluoKeyValueGenerator setColumn(Column col)
public FluoKeyValueGenerator setValue(byte[] val)
public FluoKeyValueGenerator setValue(org.apache.hadoop.io.Text val)
public FluoKeyValueGenerator setValue(Bytes val)
public FluoKeyValueGenerator setValue(String val)
public FluoKeyValueGenerator set(RowColumnValue rcv)
public FluoKeyValue[] getKeyValues()
The objects returned by this method are reused each time its called. So each time this is called it invalidates what was returned by previous calls to this method.
Copyright © 2016–2017 The Apache Software Foundation. All rights reserved.