I have some sequence files exported from Google BigTable that I need to read. They have org.apache.hadoop.hbase.io.ImmutableBytesWritable as keys and org.apache.hadoop.hbase.client.Result as values.
I found a piece of code that supposedly should be able to read it:
SequenceFile.Reader.Option fileOption = SequenceFile.Reader.file(seqfile);
reader = new SequenceFile.Reader(conf, fileOption);
WritableComparable key = (WritableComparable) reader.getKeyClass().newInstance();
Result result = null;
while (reader.next(key)) {
String skey = Bytes.toString(((ImmutableBytesWritable)key).get());
result = (Result) reader.getCurrentValue(result);
NavigableMap<byte[], byte[]> resultMap = result.getFamilyMap(Bytes.toBytes("d"));
resultMap.forEach((k, v) -> {
System.out.println(Bytes.toString(k) +" "+Bytes.toString(v));
});
}
However this line NavigableMap<byte[], byte[]> resultMap = result.getFamilyMap(Bytes.toBytes("d")); returns empty result. I was thinking maybe I should set a different column family instead of "d" in my case. When I dump the raw values to console they look like this:
keyvalues={FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH/fffffffffa0e2017/x:proto/1633359166457/Put/vlen=8853/seqid=0/\x03\x00\x00\x00(\xB5/\xFD\x00XE\x14\x01\xAC\x1A\x02\x0AU\x0A@`\xE9u=%\x87q\xF4\x95\xAD\xFA\xBEy\xA0=\x1E%\xA0\xBCLUb\xE5\xAE\xAE\xEBq\xC5\xE0\xD7\x15\xA4\x90\x15\xFBf\xB4\xE2\xCFRh\xAAO\x0A\xED\x16\xAA\x8Bw\xB0\xDE\xF5(\x89M$un\xC7\xF7\xD1\x9E\xB6\x0B\x12\x06...
So I tried setting a column family "x" instead: result.getFamilyMap(Bytes.toBytes("x"));. In this case the output is not empty but still a bunch of non-printable characters instead of plain text.
So what am I missing here?