aboutsummaryrefslogtreecommitdiff
path: root/examples/src/main
diff options
context:
space:
mode:
authorJihong MA <linlin200605@gmail.com>2015-05-05 12:40:41 +0100
committerSean Owen <sowen@cloudera.com>2015-05-05 12:40:41 +0100
commit51f462003b416eac92feb5a6725f6c2994389010 (patch)
treee45bc7a050fe920def34924111c90ee2ef8a83a0 /examples/src/main
parent4222da68dc5360b7a2a8b8bdce231e887ac2f044 (diff)
downloadspark-51f462003b416eac92feb5a6725f6c2994389010.tar.gz
spark-51f462003b416eac92feb5a6725f6c2994389010.tar.bz2
spark-51f462003b416eac92feb5a6725f6c2994389010.zip
[SPARK-7357] Improving HBaseTest example
Author: Jihong MA <linlin200605@gmail.com> Closes #5904 from JihongMA/SPARK-7357 and squashes the following commits: 7d6153a [Jihong MA] SPARK-7357 Improving HBaseTest example
Diffstat (limited to 'examples/src/main')
-rw-r--r--examples/src/main/scala/org/apache/spark/examples/HBaseTest.scala12
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/src/main/scala/org/apache/spark/examples/HBaseTest.scala b/examples/src/main/scala/org/apache/spark/examples/HBaseTest.scala
index f4684b42b5..849887d23c 100644
--- a/examples/src/main/scala/org/apache/spark/examples/HBaseTest.scala
+++ b/examples/src/main/scala/org/apache/spark/examples/HBaseTest.scala
@@ -28,7 +28,19 @@ object HBaseTest {
def main(args: Array[String]) {
val sparkConf = new SparkConf().setAppName("HBaseTest")
val sc = new SparkContext(sparkConf)
+
+ // please ensure HBASE_CONF_DIR is on classpath of spark driver
+ // e.g: set it through spark.driver.extraClassPath property
+ // in spark-defaults.conf or through --driver-class-path
+ // command line option of spark-submit
+
val conf = HBaseConfiguration.create()
+
+ if (args.length < 1) {
+ System.err.println("Usage: HBaseTest <table_name>")
+ System.exit(1)
+ }
+
// Other options for configuring scan behavior are available. More information available at
// http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/mapreduce/TableInputFormat.html
conf.set(TableInputFormat.INPUT_TABLE, args(0))