2017-08-29 3 views
1

私はapache toree(githubからのバージョン)を使用しています。私がpostgresqlテーブルに対してクエリを実行しようとしているとき、断続的なスカラーコンパイラエラーが発生しています(同じセルを2回実行すると、エラーはなくなり、コードはうまく動作します)。ScalaのAnyRefにアクセスできませんでした

これらのエラーのデバッグ方法に関するアドバイスを探しています。エラーは奇妙に見えます(ノートノブの標準出力に表示されます)。

error: missing or invalid dependency detected while loading class file 'QualifiedTableName.class'. 
Could not access type AnyRef in package scala, 
because it (or its dependencies) are missing. Check your build definition for 
missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.) 
A full rebuild may help if 'QualifiedTableName.class' was compiled against an incompatible version of scala. 
error: missing or invalid dependency detected while loading class file 'FunctionIdentifier.class'. 
Could not access type AnyRef in package scala, 
because it (or its dependencies) are missing. Check your build definition for 
missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.) 
A full rebuild may help if 'FunctionIdentifier.class' was compiled against an incompatible version of scala. 
error: missing or invalid dependency detected while loading class file 'DefinedByConstructorParams.class'. 
... 

コードは単純である:Postgresのテーブルからデータセットを抽出:

%AddDeps org.postgresql postgresql 42.1.4 --transitive 
val props = new java.util.Properties(); 
props.setProperty("driver","org.postgresql.Driver"); 
val df = spark.read.jdbc(url = "jdbc:postgresql://postgresql/database?user=user&password=password", 
       table = "table", predicates = Array("1=1"), connectionProperties = props) 
df.show() 

iは明白(toreeおよびApacheスパーク使用の両方スカラ2.11.8についてチェック、私はAPACHE_SPARK_VERSIONとApacheのtoreeを構築し

RUN wget https://d3kbcqa49mib13.cloudfront.net/spark-2.2.0-bin-hadoop2.7.tgz && tar -zxf spark-2.2.0-bin-hadoop2.7.tgz && chmod -R og+rw /opt/spark-2.2.0-bin-hadoop2.7 && chown -R a1414.a1414 /opt/spark-2.2.0-bin-hadoop2.7 
RUN (curl https://bintray.com/sbt/rpm/rpm > /etc/yum.repos.d/bintray-sbt-rpm.repo) 
RUN yum -y install --nogpgcheck sbt 
RUN (unset http_proxy; unset https_proxy; yum -y install --nogpgcheck java-1.8.0-openjdk-devel.i686) 
RUN (git clone https://github.com/apache/incubator-toree && cd incubator-toree && make clean release APACHE_SPARK_VERSION=2.2.0 ; exit 0) 
RUN (. /opt/rh/rh-python35/enable; cd /opt/incubator-toree/dist/toree-pip ;python setup.py install) 
RUN (. /opt/rh/rh-python35/enable; jupyter toree install --spark_home=/opt/spark-2.2.0-bin-hadoop2.7 --interpreters=Scala) 
:= iはdonwloadedスパーク)参考

と同じである2.2.0を、これは私がtoreeと火花を設定するために使用Dockerfileの一部であります

+0

スカラ座の異なるバージョンである(LIB) – cchantep

+0

に応じて、ライブラリ間の紛争:

最も簡単な解決策は、Sparkで使用される1つのチェック、およびMac上で例えば、この1、に切り替えることです私も何とかやっていますが、奇妙なことはときどきうまくいくということです。見つけ出す方法はありますか?私はsbtを使用して依存関係ツリーを作成しようとしましたが、スカラーlibの複数のバージョンは表示されません:https://gist.github.com/anonymous/1ea6f24a30ac77a2252884227b88d522 – kervel

+0

依存関係ツリーを確認してください – cchantep

答えて

0

cchantepのコメントで言われたように、Sparkのビルドに使用したものとは異なるScalaバージョンを使用している可能性があります。おそらく

brew switch scala 2.11.8 
関連する問題