Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

POST a json to a flume agent - the custom serializer only saving the last json object in hbase

POST a json to a flume agent - the custom serializer only saving the last json object in hbase

New Contributor

Hi,

 

I am posting a json to a flume agent, I am using the same serializer as here with some changes :

 

https://blogs.apache.org/flume/entry/streaming_data_into_apache_hbase

 

trying to serialize my body which look like this : [{"test" : "a", "data": 1}, {"test" : "b", "data": 2}]

 

so I am looping over the json array but only the last object is hbase due to the PutRequest:

 

 

 PutRequest req = new PutRequest(table, currentRowKey, colFam,              columnNames[i], cols[i].getBytes());      puts.add(req);

 

 

any idea what is wrong? is it related to the fact I have one row key while I have to insert many rows? how to solve it?

1 REPLY 1

Re: POST a json to a flume agent - the custom serializer only saving the last json object in hbase

Master Guru
> any idea what is wrong? is it related to the fact I have one row key while I have to insert many rows? how to solve it?

Is the issue that for a single row key you're only seeing one column being persisted (i.e. only the last one from your array, as you describe), or are you trying to make it such that you get multiple rows from your array?

If the former, how are you inspecting the data on the HBase-end? Via a "get"?