简体   繁体   English

火花壳依赖,从sbt转换

[英]spark-shell dependencies, translate from sbt

While checking how to use the cassandra connection, the documentation instructs to add this to the sbt file: 在检查如何使用cassandra连接时,文档指示将其添加到sbt文件中:

"libraryDependencies += "com.datastax.spark" %% "spark-cassandra-connector" % "1.6.0-M1"

In general, is there an obvious, straight forward logic to translate this into the corresponding: 通常,是否存在明显,直接的逻辑将其转换为相应的逻辑:

spark-shell --packages "field1":"field2"

I've tried: 我试过了:

spark-shell --packages "com.datastax.spark":"spark-cassandra-connector"

and a few other things but that doesn't work. 和其他一些事情,但这是行不通的。

I believe it is --packages "groupId:artifactId:version" . 我相信它是--packages "groupId:artifactId:version" If you have multiple packages, you can comma separate them. 如果有多个软件包,可以用逗号分隔。 --packages "groupId1:artifactId1:version1, groupId2:artifactId2:version2"

In sbt 在sbt

val appDependencies = Seq(
  "com.datastax.spark" % "spark-cassandra-connector_2.10" % "1.6.0-M1"
)

and

val appDependencies = Seq(
  "com.datastax.spark" %% "spark-cassandra-connector" % "1.6.0-M1"
)

are identical. 都是一样的 In case you use %% syntax (after the groupId) in sbt, it automatically picks up the artifact for your scala version. 如果您在sbt中使用%%语法(在groupId之后),它将自动为您的Scala版本选择工件。 So using scala 2.10 it changes your spark-cassandra-connector to spark-cassandra-connector_2.10. 因此,使用scala 2.10会将您的spark-cassandra-connector更改为spark-cassandra-connector_2.10。 Not sure this feature is there when using spark-shell, so you might need to ask for the scala2_10 version of your artifact explicitly like this: --packages "com.datastax.spark:spark-cassandra-connector_2.10:1.6.0-M1" 使用spark-shell时不确定此功能是否存在,因此您可能需要明确要求工件的scala2_10版本,如下所示:-- --packages "com.datastax.spark:spark-cassandra-connector_2.10:1.6.0-M1"

Version should be specified. 应该指定版本。

spark-shell --packages "com.datastax.spark":"spark-cassandra-connector_2.11":"2.0.0-M3"

You can find version information from http://search.maven.org/#search%7Cga%7C1%7Cspark-cassandra-connector . 您可以从http://search.maven.org/#search%7Cga%7C1%7Cspark-cassandra-connector找到版本信息。

Follow the instructions as posted on the Spark Packages Website 按照Spark Packages网站上发布的说明进行操作

To use the Spark-Shell 使用Spark-Shell

$SPARK_HOME/bin/spark-shell --packages datastax:spark-cassandra-connector:1.6.0-M1-s_2.10 $ SPARK_HOME / bin / spark-shell-打包数据税:spark-cassandra-connector:1.6.0-M1-s_2.10

There are also instructions for a variety of build systems 也有针对各种构建系统的说明

SBT SBT

resolvers += "Spark Packages Repo" at "http://dl.bintray.com/spark-packages/maven"

libraryDependencies += "datastax" % "spark-cassandra-connector" % "1.6.0-M1-s_2.11"

And Maven 和Maven

<dependencies>
  <!-- list of dependencies -->
  <dependency>
    <groupId>datastax</groupId>
    <artifactId>spark-cassandra-connector</artifactId>
    <version>1.6.0-M1-s_2.11</version>
  </dependency>
</dependencies>
<repositories>
  <!-- list of other repositories -->
  <repository>
    <id>SparkPackagesRepo</id>
    <url>http://dl.bintray.com/spark-packages/maven</url>
  </repository>
</repositories>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM