spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Devi P.V" <devip2...@gmail.com>
Subject How to write data into CouchBase using Spark & Scala?
Date Wed, 07 Sep 2016 06:42:11 GMT
I am newbie in CouchBase.I am trying to write data into CouchBase.My sample
code is following,

val cfg = new SparkConf()
  .setAppName("couchbaseQuickstart")
  .setMaster("local[*]")
  .set("com.couchbase.bucket.MyBucket","pwd")

val sc = new SparkContext(cfg)
val doc1 = JsonDocument.create("doc1", JsonObject.create().put("some",
"content"))
val doc2 = JsonArrayDocument.create("doc2", JsonArray.from("more",
"content", "in", "here"))

val data = sc
  .parallelize(Seq(doc1, doc2))

But I can't access data.saveToCouchbase().

I am using Spark 1.6.1 & Scala 2.11.8

I gave following dependencies in built.sbt

libraryDependencies += "org.apache.spark" % "spark-core_2.11" % "1.6.1"
libraryDependencies += "com.couchbase.client" % "spark-connector_2.11" % "1.2.1"


How can I write data into CouchBase using Spark & Scala?

Mime
View raw message