You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by suman bharadwaj <su...@gmail.com> on 2013/11/28 19:57:44 UTC

Regarding Spark and Hbase

Hi Guys,

I was trying to read data from hbase. Below is the code which i've written.

val conf = HBaseConfiguration.create()
conf.set("hbase.rootdir", "hdfs://server:port/hbase")
conf.set(TableInputFormat.INPUT_TABLE, "test")
conf.setBoolean("hbase.cluster.distributed", true)
conf.set("hbase.zookeeper.quorum", "server")
val *testRDD* = sc.newAPIHadoopRDD(conf, classOf[TableInputFormat],
classOf[org.apache.hadoop.hbase.io.ImmutableBytesWritable],
classOf[org.apache.hadoop.hbase.client.Result])
testRDD.count()

I'm able to successfully read the data from hbase and perform actions such
as count() and take(). But how do we read the Key and Values individually
from testRDD(Highlighted in bold above).

Thanks in advance.

Regards,
suman

Re: Regarding Spark and Hbase

Posted by suman bharadwaj <su...@gmail.com>.
Thanks figured it out.


On Fri, Nov 29, 2013 at 12:27 AM, suman bharadwaj <su...@gmail.com>wrote:

> Hi Guys,
>
> I was trying to read data from hbase. Below is the code which i've written.
>
> val conf = HBaseConfiguration.create()
> conf.set("hbase.rootdir", "hdfs://server:port/hbase")
> conf.set(TableInputFormat.INPUT_TABLE, "test")
> conf.setBoolean("hbase.cluster.distributed", true)
> conf.set("hbase.zookeeper.quorum", "server")
> val *testRDD* = sc.newAPIHadoopRDD(conf, classOf[TableInputFormat],
> classOf[org.apache.hadoop.hbase.io.ImmutableBytesWritable],
> classOf[org.apache.hadoop.hbase.client.Result])
> testRDD.count()
>
> I'm able to successfully read the data from hbase and perform actions such
> as count() and take(). But how do we read the Key and Values individually
> from testRDD(Highlighted in bold above).
>
> Thanks in advance.
>
> Regards,
> suman
>
>