运行 spark-shell 来自 sbt

Run spark-shell from sbt

获取 spark shell 的默认方式似乎是 to download the distribution from the website. Yet, this spark issue 提到可以通过 sbt 安装它。我找不到这方面的文档。在使用 spark-sqlspark-core 的 sbt 项目中,没有找到 spark-shell 二进制文件。

你从 sbt 运行 spark-shell 怎么样?

来自以下URL:

https://bzhangusc.wordpress.com/2015/11/20/use-sbt-console-as-spark-shell/

If you already using Sbt for your project, it’s very simple to setup Sbt Console to replace Spark-shell command. Let’s start from the basic case. When you setup the project with sbt, you can simply run the console as sbt console

Within the console, you just need to initiate SparkContext and SQLContext to make it behave like Spark Shell

scala> val sc = new org.apache.spark.SparkContext("localhell")
scala> val sqlContext = new org.apache.spark.sql.SQLContext(sc)