Thanks , It worked !!

On Mon, Dec 19, 2016 at 5:55 PM, Dhaval Modi <dhavalmod...@gmail.com> wrote:

>
> Replace <output_table_name> with "<namespace>:<output_table_name>"
>
> Regards,
> Dhaval Modi
>
> On 19 December 2016 at 13:10, Rabin Banerjee <dev.rabin.baner...@gmail.com
> > wrote:
>
>> HI All,
>>
>>   I am trying to save data from Spark into HBase using saveHadoopDataSet
>> API . Please refer the below code . Code is working fine .But the table is
>> getting stored in the default namespace.how to set the NameSpace in the
>> below code?
>>
>>
>>
>>
>> wordCounts.foreachRDD ( rdd =&gt; {
>>   val conf = HBaseConfiguration.create()
>>   conf.set(TableOutputFormat.OUTPUT_TABLE, "stream_count")
>>   conf.set("hbase.zookeeper.quorum", "localhost:2181")
>>   conf.set("hbase.master", "localhost:60000");
>>   conf.set("hbase.rootdir", "file:///tmp/hbase")
>>
>>   val jobConf = new Configuration(conf)
>>   jobConf.set("mapreduce.job.output.key.class", classOf[Text].getName)
>>   jobConf.set("mapreduce.job.output.value.class", classOf[LongWritable].
>> getName)
>>   jobConf.set("mapreduce.outputformat.class", classOf[TableOutputFormat[
>> Text]].getName)
>>
>>   rdd.saveAsNewAPIHadoopDataset(jobConf)
>> })
>>
>> Regards,
>> R Banerjee
>>
>
>

Reply via email to