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 => {
  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