Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running in Spark 2.2 #59

Open
abstract-karshit opened this issue Sep 28, 2017 · 0 comments
Open

Running in Spark 2.2 #59

abstract-karshit opened this issue Sep 28, 2017 · 0 comments

Comments

@abstract-karshit
Copy link

import it.nerdammer.spark.hbase._
import org.apache.spark.sql.SparkSession

object SparkHBase {
  def main(args: Array[String]): Unit = {
    val spark = SparkSession
      .builder
      .appName("FunnelSpark")
      .master("local[*]")
      .config("spark.hbase.host", "localhost")
      .getOrCreate

    val sc = spark.sparkContext
    sc.hadoopConfiguration.set("spark.hbase.host", "localhost")

    val rdd = sc.parallelize(1 to 100)
      .map(i => (i.toString, i + 1, "Hello"))

    rdd.toHBaseTable("mytable")
      .toColumns("column1", "column2")
      .inColumnFamily("mycf")
      .save()

    spark.stop()

  }

}

This code is writing data to HBase but than it failes with this error:

java.lang.IllegalArgumentException: Can not create a Path from a null string
	at org.apache.hadoop.fs.Path.checkPathArg(Path.java:123)
	at org.apache.hadoop.fs.Path.<init>(Path.java:135)
	at org.apache.hadoop.fs.Path.<init>(Path.java:89)
	at org.apache.spark.internal.io.HadoopMapReduceCommitProtocol.absPathStagingDir(HadoopMapReduceCommitProtocol.scala:58)
	at org.apache.spark.internal.io.HadoopMapReduceCommitProtocol.commitJob(HadoopMapReduceCommitProtocol.scala:132)
	at org.apache.spark.internal.io.SparkHadoopMapReduceWriter$.write(SparkHadoopMapReduceWriter.scala:101)
	at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsNewAPIHadoopDataset$1.apply$mcV$sp(PairRDDFunctions.scala:1085)
	at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsNewAPIHadoopDataset$1.apply(PairRDDFunctions.scala:1085)
	at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsNewAPIHadoopDataset$1.apply(PairRDDFunctions.scala:1085)
	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
	at org.apache.spark.rdd.RDD.withScope(RDD.scala:362)
	at org.apache.spark.rdd.PairRDDFunctions.saveAsNewAPIHadoopDataset(PairRDDFunctions.scala:1084)
	at it.nerdammer.spark.hbase.HBaseWriter.save(HBaseWriterBuilder.scala:102)
	at SparkHBase$.main(SparkHBase.scala:47)
	at SparkHBase.main(SparkHBase.scala)```
@abstract-karshit abstract-karshit changed the title Spark 2.2: Exception in thread "main" java.lang.IllegalArgumentException: Can not create a Path from a null string Running in Spark 2.2 Sep 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant