【问题标题】:spark build path is cross-compiled with an incompatible version of Scala (2.11.0)spark 构建路径与不兼容的 Scala (2.11.0) 版本交叉编译
【发布时间】:2020-09-28 22:48:25
【问题描述】:

我在 Scala IDE 中观察到一些构建错误。虽然我知道如何修复,但我仍然不明白它是如何工作的。我先详细说明我的情况,然后问最底层的问题。

环境:mac

spark 2.4.5 版:brew info apache-spark 返回apache-spark: stable 2.4.5, HEAD 从官方页面 (https://spark.apache.org/docs/latest/index.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

这会导致很多构建错误(为了节省空间,这里只发布其中的一部分):

从错误中我得到了尝试 scala 2.11 的想法。它可以工作并修复构建错误,但我不满意,因为我仍然不明白它是如何工作的。报错信息中提到的jar文件均取自spark 2.4.5安装文件夹(/usr/local/Cellar/apache-spark/2.4.5/libexec/jars/)

所以,我的问题是:

  1. 为什么选择 scala 2.11 修复构建错误,因为我使用的是 spark 2.4.5(基于 https://spark.apache.org/docs/latest/index.html 使用 2.12 构建)。为什么 scala 2.12 不起作用

  2. 我的理解是,/usr/local/Cellar/apache-spark/2.4.5/libexec/jars 中的大多数 .jar 文件都是使用 scala 2.11 构建的。仅基于文件名: 微风_2.11-0.13.2.jar、spark-core_2.11-2.4.5.jar 等等。是预期的吗?

【问题讨论】:

    标签: scala apache-spark scala-ide


    【解决方案1】:

    我会自己回复。

    声明“对于 Scala API,Spark 2.4.5 使用 Scala 2.12。您需要使用兼容的 Scala 版本 (2.12.x)。” (取自这里https://spark.apache.org/docs/latest/index.html)具有误导性。

    这里是 spark 发布的历史:

    2.4.1 (https://spark.apache.org/releases/spark-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. 因此 spark 是用 scala 2.12 从 2.4.1 开始构建的

    2.4.2(https://spark.apache.org/releases/spark-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.org/releases/spark-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

    【讨论】:

      猜你喜欢
      • 2016-11-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-31
      • 2017-10-08
      • 2018-03-11
      • 1970-01-01
      • 2021-02-05
      相关资源
      最近更新 更多