hadoop - hbase scan with spark : scan.setCaching() method do not found -
import org.apache.hadoop.hbase.io.immutablebyteswritable import org.apache.hadoop.hbase.mapreduce.tableinputformat import org.apache.hadoop.hbase.protobuf.protobufutil import org.apache.hadoop.hbase.util.{base64, bytes} import org.apache.hadoop.hbase.hbaseconfiguration import org.apache.hadoop.hbase.client._ import org.apache.hadoop.hbase.client.scan import org.apache.spark.sparkcontext import org.apache.spark.sparkconf def main(args: array[string]) { val sparkconf = new sparkconf().setappname("simple spark app") val sc = new sparkcontext(sparkconf) var input_hbase_table = args(0) var output = args(1) val conf = hbaseconfiguration.create() conf.set(tableinputformat.input_table, input_hbase_table) var scan = new scan() scan.setcaching(1000) scan.setcacheblocks(false) conf.set(tableinputformat.scan, convertscantostring(scan)) val hbase_rdd = sc.newapihadooprdd(conf, classof[tableinputformat], classof[immutablebyteswritable], classof[result]) // todo hbase_rdd.map(my_map_func).saveastextfile(output) }
sbt blow:
name := "sparkonhbase" version := "1.0" scalaversion := "2.10.6" librarydependencies ++= seq( "org.apache.spark" %% "spark-core" % "2.0.1", "org.apache.hadoop" % "hadoop-core" % "1.2.1", "org.apache.hbase" % "hbase" % "1.2.4", "org.apache.hbase" % "hbase-client" % "1.2.4", "org.apache.hbase" % "hbase-common" % "1.2.4", "org.apache.hbase" % "hbase-server" % "1.2.4" )
the exception in log is:
java.lang.nosuchmethoderror:org.apache.hadoop.hbase.client.scan.setcaching(i)
but, if remove scan.setcaching()
, scan.setcacheblocks()
, ok.
Comments
Post a Comment