ノートブックで最新の spark-cloudant パッケージを使用しようとしています:
%AddJar -f https://github.com/cloudant-labs/spark-cloudant/releases/download/v1.6.4/cloudant-spark-v1.6.4-167.jar
どの出力:
Starting download from https://github.com/cloudant-labs/spark-cloudant/releases/download/v1.6.4/cloudant-spark-v1.6.4-167.jar
Finished download of cloudant-spark-v1.6.4-167.jar
に続く:
val dfReader = sqlContext.read.format("com.cloudant.spark")
dfReader.option("cloudant.host", sourceDB.host)
if (sourceDB.username.isDefined && sourceDB.username.get.nonEmpty) dfReader.option("cloudant.username", sourceDB.username.get)
if (sourceDB.password.isDefined && sourceDB.password.get.nonEmpty) dfReader.option("cloudant.password", sourceDB.password.get)
val df = dfReader.load(sourceDB.database).cache()
どの出力:
Use connectorVersion=1.6.3, dbName=ratingdb, indexName=null, viewName=null,jsonstore.rdd.partitions=5, + jsonstore.rdd.maxInPartition=-1,jsonstore.rdd.minInPartition=10, jsonstore.rdd.requestTimeout=900000,bulkSize=20, schemaSampleSize=1
コネクタは 1.6.3 です。私のノートは:
Scala 2.10 with Spark 1.6
カーネルを再起動しようとしましたが、役に立ちませんでした。
その他のデバッグ情報:
Server Information:
You are using Jupyter notebook.
The version of the notebook server is 4.2.0 and is running on:
Python 2.7.11 (default, Jun 24 2016, 12:41:03)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]
Current Kernel Information:
IBM Spark Kernel
アップデート
私は次のことを試しました:
import sys.process._
"test -d ~/data/libs/scala-2.10" #|| "mkdir -p ~/data/libs/scala-2.10" !
"wget -c -O ~/data/libs/scala-2.10/cloudant-spark-v1.6.4-167.jar https://github.com/cloudant-labs/spark-cloudant/releases/download/v1.6.4/cloudant-spark-v1.6.4-167.jar" !
"ls ~/data/libs/scala-2.10/" !
println("Now restart the kernel")
残念ながら、これは機能しませんでした。1.6.3 がまだ使用されています。
更新 2
上記のコードでは、チルダが HOME フォルダーに解決されていないようです。
実用的なソリューションについては、回答を参照してください。