I have a HBASE table with script:
create 'STATE_STORE', {NAME => 'CREATIVE_GROUP'}, {NAME => 'CREATIVE'},
{NAME =>'AD_CODE'}.
I put integer value '1000' in column family 'CREATIVE_GROUP' with column
name 'STATE'.
When I tried to get value from the same table with column family 'CREATIVE'
and column name 'STATE' i'm getting '1000' instead of 'NULL'.
What can be the issue ?
My code for get and put is as follows,
PUT:
void putToHbase() {
Configuration conf = new Configuration();
conf.set("hbase.zookeeper.quorum", "demo-hadoop1");
conf.set("hbase.zookeeper.property.clientPort", "2181");
byte[] byteValue = Bytes.toBytes(1000);
String colFamily = "CREATIVE_GROUP";
HTableInterface hbaseStateStore=null;
try {
hbaseStateStore = new HTable(conf, "STATE_STORE");
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Put put = new Put(Bytes.toBytes("" + 3001));
put.add(Bytes.toBytes(colFamily), Bytes.toBytes("STATE"),
byteValue);
try {
hbaseStateStore.put(put);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
GET:
static void print() {
Configuration conf = new Configuration();
conf.set("hbase.zookeeper.quorum", "192.168.150.203");
conf.set("hbase.zookeeper.property.clientPort", "2181");
HTableInterface htable = null;
byte[] key = Bytes.toBytes("3001");
Get g = new Get(key);
Advertiser ad = null;
MsisdnAlgoDetails[] algos = null;
try {
htable = new HTable(conf, "STATE_STORE");
Result res = htable.get(g);
byte[] value = res.getValue(Bytes.toBytes("CREATIVE"),
Bytes.toBytes("STATE"));
System.out.println(Bytes.toInt(value));
} catch (Exception e) {
}
}
Result for GET:-
1000
Waiting for your reply, Thanks in Advance.
--
View this message in context: http://apache-hbase.679495.n3.nabble.com/While-putting-value-in-one-column-family-results-getting-the-same-value-from-every-column-family-of--tp3781052p3781052.html
Sent from the HBase - Developer mailing list archive at Nabble.com.