|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.client.Result
public class Result
Single row result of a Get
or Scan
query.
Convenience methods are available that return various Map
structures and values directly.
To get a complete mapping of all cells in the Result, which can include
multiple families and multiple versions, use getMap()
.
To get a mapping of each family to its columns (qualifiers and values),
including only the latest version of each, use getNoVersionMap()
.
To get a mapping of qualifiers to latest values for an individual family use
getFamilyMap(byte[])
.
To get the latest value for a specific family and qualifier use getValue(byte[], byte[])
.
A Result is backed by an array of KeyValue
objects, each representing
an HBase cell defined by the row, family, qualifier, timestamp, and value.
The underlying KeyValue
objects can be accessed through the methods
sorted()
and list()
. Each KeyValue can then be accessed
through KeyValue.getRow()
, KeyValue.getFamily()
, KeyValue.getQualifier()
,
KeyValue.getTimestamp()
, and KeyValue.getValue()
.
Constructor Summary | |
---|---|
Result()
Constructor used for Writable. |
|
Result(KeyValue[] kvs)
Instantiate a Result with the specified array of KeyValues. |
|
Result(List<KeyValue> kvs)
Instantiate a Result with the specified List of KeyValues. |
Method Summary | |
---|---|
boolean |
containsColumn(byte[] family,
byte[] qualifier)
Checks for existence of the specified column. |
Cell |
getCellValue()
|
Cell |
getCellValue(byte[] family,
byte[] qualifier)
|
Cell[] |
getCellValues()
|
NavigableMap<byte[],byte[]> |
getFamilyMap(byte[] family)
Map of qualifiers to values. |
NavigableMap<byte[],NavigableMap<byte[],NavigableMap<Long,byte[]>>> |
getMap()
Map of families to all versions of its qualifiers and values. |
NavigableMap<byte[],NavigableMap<byte[],byte[]>> |
getNoVersionMap()
Map of families to their most recent qualifiers and values. |
byte[] |
getRow()
Method for retrieving the row that this result is for |
RowResult |
getRowResult()
Returns this Result in the old return format, RowResult . |
byte[] |
getValue(byte[] column)
Get the latest version of the specified column, using |
byte[] |
getValue(byte[] family,
byte[] qualifier)
Get the latest version of the specified column. |
boolean |
isEmpty()
Check if the underlying KeyValue [] is empty or not |
List<KeyValue> |
list()
Create a sorted list of the KeyValue's in this result. |
KeyValue[] |
raw()
Return the unsorted array of KeyValues backing this Result instance. |
static Result[] |
readArray(DataInput in)
|
void |
readFields(DataInput in)
|
int |
size()
|
KeyValue[] |
sorted()
Returns a sorted array of KeyValues in this Result. |
String |
toString()
|
byte[] |
value()
Returns the value of the first column in the Result. |
void |
write(DataOutput out)
|
static void |
writeArray(DataOutput out,
Result[] results)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Result()
public Result(KeyValue[] kvs)
kvs
- array of KeyValuespublic Result(List<KeyValue> kvs)
kvs
- List of KeyValuesMethod Detail |
---|
public byte[] getRow()
public KeyValue[] raw()
public List<KeyValue> list()
public KeyValue[] sorted()
Note: Sorting is done in place, so the backing array will be sorted after calling this method.
public NavigableMap<byte[],NavigableMap<byte[],NavigableMap<Long,byte[]>>> getMap()
Returns a three level Map of the form:
Map
Note: All other map returning methods make use of this map internally.
public NavigableMap<byte[],NavigableMap<byte[],byte[]>> getNoVersionMap()
Returns a two level Map of the form: Map
The most recent version of each qualifier will be used.
public NavigableMap<byte[],byte[]> getFamilyMap(byte[] family)
Returns a Map of the form: Map
public byte[] getValue(byte[] family, byte[] qualifier)
family
- family namequalifier
- column qualifier
public Cell getCellValue(byte[] family, byte[] qualifier)
public Cell getCellValue()
public Cell[] getCellValues()
public byte[] getValue(byte[] column)
family:qualifiernotation.
column
- column in family:qualifier notation
public boolean containsColumn(byte[] family, byte[] qualifier)
family
- family namequalifier
- column qualifier
public RowResult getRowResult()
RowResult
.
public byte[] value()
public boolean isEmpty()
public int size()
public String toString()
toString
in class Object
public void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
public void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public static void writeArray(DataOutput out, Result[] results) throws IOException
IOException
public static Result[] readArray(DataInput in) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |