Skip to content

Commit ce18d68

Browse files
JihongMAnemccarthy
authored andcommitted
[SPARK-7357] Improving HBaseTest example
Author: Jihong MA <[email protected]> Closes apache#5904 from JihongMA/SPARK-7357 and squashes the following commits: 7d6153a [Jihong MA] SPARK-7357 Improving HBaseTest example
1 parent 5695fc1 commit ce18d68

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

examples/src/main/scala/org/apache/spark/examples/HBaseTest.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,19 @@ object HBaseTest {
2828
def main(args: Array[String]) {
2929
val sparkConf = new SparkConf().setAppName("HBaseTest")
3030
val sc = new SparkContext(sparkConf)
31+
32+
// please ensure HBASE_CONF_DIR is on classpath of spark driver
33+
// e.g: set it through spark.driver.extraClassPath property
34+
// in spark-defaults.conf or through --driver-class-path
35+
// command line option of spark-submit
36+
3137
val conf = HBaseConfiguration.create()
38+
39+
if (args.length < 1) {
40+
System.err.println("Usage: HBaseTest <table_name>")
41+
System.exit(1)
42+
}
43+
3244
// Other options for configuring scan behavior are available. More information available at
3345
// http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/mapreduce/TableInputFormat.html
3446
conf.set(TableInputFormat.INPUT_TABLE, args(0))

0 commit comments

Comments
 (0)