ImmutableBytesWritable其实就是hbase把其封装成的rowkey,如果要通过collect算子收集到客户端driver,涉及到序列化的操作:
new SparkConf().set("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
接下来如果要打印出rowkey:
hbaseRDD.map {
//new String(rowkey.get()),new String(res.getRow)都可以拿到rowkey
case (rowkey, res) => (new String(rowkey.get()),new String(res.getRow))
}
即可