【问题标题】:How to add library to spark shell如何将库添加到 spark shell
【发布时间】:2020-08-13 17:29:00
【问题描述】:

我有一个我想在 spark shell 中使用的库,如何添加这个库以便可以从 spark shell 访问? sbt:

resolvers += Resolver.bintrayRepo("unsupervise", "maven")
libraryDependencies += "com.github.unsupervise" %% "spark-tss" % "0.1.1"

行家:

<dependencies>
<!-- Other Dependencies -->
    <dependency>
        <groupId>com.github.unsupervise</groupId>
        <artifactId>spark-tss_2.11</artifactId>
        <version>0.1.1</version>
    </dependency>
</dependencies>
<repositories>
<!-- Other Repositories ... -->
    <repository>
        <id>bintrayunsupervisemaven</id>
        <name>bintray-unsupervise-maven</name>
        <url>https://dl.bintray.com/unsupervise/maven/</url>
        <layout>default</layout>
    </repository>
</repositories>

【问题讨论】:

    标签: scala maven apache-spark spark-shell


    【解决方案1】:

    当你在本地有罐子时:

    ./spark-shell --jars pathOfjarsWithCommaSeprated

    当二进制工件(jar)通过像 Maven 或 Nexus 这样的工件存储库进行管理时,您将使用像 group idartifact id 这样的工件坐标版本

    参考:http//spark.apache.org/docs/latest/rdd-programming-guide.html#using-the-shell

    ./bin/spark-shell --master local[4] --packages "com.github.unsupervise:spark-tss_2.11:0.1.1"

    【讨论】:

    • 我没有jar,我只有maven或者sbt这两个导师。
    • 更新了我的答案
    【解决方案2】:

    使用repositoriespackages 参数。

    spark-shell \
      --repositories "https://dl.bintray.com/unsupervise/maven" \
      --packages "com.github.unsupervise:spark-tss_2.11:0.1.1"
    

    【讨论】:

      猜你喜欢
      • 2021-03-14
      • 1970-01-01
      • 1970-01-01
      • 2015-08-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多