Skip to content

Instantly share code, notes, and snippets.

@darionyaphet
Created April 28, 2016 04:34
Show Gist options
  • Save darionyaphet/4cbbc02633b4f96d4f8a9f869b597c2d to your computer and use it in GitHub Desktop.
Save darionyaphet/4cbbc02633b4f96d4f8a9f869b597c2d to your computer and use it in GitHub Desktop.
import org.apache.hadoop.hbase.HBaseConfiguration
import org.apache.hadoop.hbase.io.ImmutableBytesWritable
import org.apache.hadoop.hbase.client.Result
import org.apache.hadoop.hbase.mapreduce.TableInputFormat
val conf = HBaseConfiguration.create()
conf.set("zookeeper.znode.parent", "/hbase")
conf.set("hbase.zookeeper.property.clientPort", "2181")
conf.set("hbase.zookeeper.quorum", "zk0,zk1,zk2,zk3,zk4")
conf.set(TableInputFormat.INPUT_TABLE, "test")
val set = sc.newAPIHadoopRDD(conf,
classOf[TableInputFormat],
classOf[ImmutableBytesWritable],
classOf[Result])
val count = set.count()
println("Count:" + count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment