在 Spark 中导入 lib 时出现问题

Problems importing lib in Spark

我正在寻找一些为 Spark + Scala 提供分数的库,并找到了 this link

我不确定,我是否可以使用它或者我无法使用它? 在 spark-shell 我正在写 import org.apache.commons.math4.fraction 并得到

<console>:23: error: object math4 is not a member of package org.apache.commons
       import org.apache.commons.math4.fraction

虽然我可以 import org.apache.commons 没有任何麻烦。

你能解释一下这是怎么回事吗?或者你可以推荐一些其他的分数库?

提前致谢。

您需要下载 jar 文件并在 运行 spark-shell

时使用

here 下载 jar 文件。

现在在某个位置提取

tar xvf <location of tar/ zip files>

现在开始 spark-shell 作为

./spark-shell --jars path to this jar file commons-math3-3.6.1.jar

并用作

import org.apache.commons.math3.fraction