Created
April 28, 2016 04:34
-
-
Save darionyaphet/4cbbc02633b4f96d4f8a9f869b597c2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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