spark的构建路径与Scala(2.11.0)的不兼容版本交叉编译。

问题描述 投票:0回答:1

我在Scala IDE中观察到一些构建错误。虽然我知道如何修复,但我还是不明白这到底是如何工作的。我先阐述一下我的情况,并在最下面提出问题。

环境:mac

火花版本2.4.5。brew info apache-spark 返回 apache-spark: stable 2.4.5, HEAD从官方网页 (https:/spark.apache.orgdocslatestindex.html。)我看到的是这个。Spark 2.4.5 uses Scala 2.12. You will need to use a compatible Scala version (2.12.x). 所以,我的理解是,我需要在scala IDE中选择2. 12版本的scala。

enter image description here

这最终导致了许多构建错误(为了节省篇幅,这里只贴出部分错误)。

enter image description here

从这些错误中,我得到了一个想法,那就是尝试使用scala。2.11. 它工作并修复了构建错误,但我并不满意,因为我仍然不明白这是如何工作的。错误信息中提到的jar文件都来自spark 2.4.5安装文件夹(usrlocalCellarapache-spark2.4.5libexecjars)。

所以,我的问题是:为什么选择scala 2.11可以修复构建错误?

  1. 为什么选择scala 2.11可以修复构建错误,因为我使用的是spark 2.4.5 (它是基于2.12构建的)。https:/spark.apache.orgdocslatestindex.html。). 为什么scala 2.12不能工作?

  2. 我的理解是,大多数的.jar文件在 /usr/local/Cellar/apache-spark/2.4.5/libexec/jars 是用scala 2.11构建的。只是根据文件名:breeze_2.11-0.13.2.2.jar、spark-core_2.11-2.4.5.jar等。这是预期的吗?

scala apache-spark scala-ide
1个回答
0
投票

我自己来回答。

对于Scala API,Spark 2.4.5使用Scala 2.12。你需要使用兼容的Scala版本(2.12.x)。" (摘自这里 https:/spark.apache.orgdocslatestindex.html。)是误导性的。

enter image description here

这里是火花发布的历史。

2.4.1 (https:/spark.apache.orgreleasesspark-release-2-4-1.html。):

In Apache Spark 2.4.1, Scala 2.12 support is GA, and it’s no longer experimental. We will drop Scala 2.11 support in Spark 3.0, so please provide us feedback.因此,从2.4.1开始,用scala 2.12来构建火花。

2.4.2 (https:/spark.apache.orgreleasesspark-release-2-4-1.html。): Note that Scala 2.11 support is deprecated from 2.4.1 onwards. As of 2.4.2, the pre-built convenience binaries are compiled for Scala 2.12.

但是在2.4.3版本,scala又恢复到了2.11版本

2.4.3 (https:/spark.apache.orgreleasesspark-release-2-4-3.html。): Note that 2.4.3 switched the default Scala version from Scala 2.12 to Scala 2.11, which is the default for all the previous 2.x releases except 2.4.2

© www.soinside.com 2019 - 2024. All rights reserved.