You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by "Cavus,M.,Fa. Post Direkt" <M....@postdirekt.de> on 2011/01/04 11:12:01 UTC
Output is null why?
My Outpu ist null Why? Here is my Java Code:
import java.io.IOException;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;
public class FirstHBaseClientRead {
public static void main(String[] args) throws IOException {
HBaseConfiguration config = new HBaseConfiguration();
HTable table = new HTable(config, "Table");
Get get = new Get(Bytes.toBytes("FirstRowKey"));
Result result = table.get(get);
byte[] value= result.getValue(Bytes.toBytes("F1"),
Bytes.toBytes("FirstColumn"));
System.out.println(Bytes.toString(value));
}
}
This is my Test Table:
hbase(main):013:0> scan 'Table'
ROW COLUMN+CELL
FirstRowKey column=F1:Firstcolumn,
timestamp=1294132718775, value=First Value
FirstRowKey1 column=F1:Firstcolumn,
timestamp=1294134178724, value=First Value1
FirstRowKey1 column=F1:Firstcolumn1,
timestamp=1294134197574, value=First Value1
2 row(s) in 0.1030 seconds