-
spark-shell
command line options
-
Scala REPL options:
-
Generic options:
-
Cluster deploy mode only:
-
Spark standalone or Mesos with cluster deploy mode only:
-
Spark standalone and Mesos only:
-
Spark standalone and YARN only:
-
YARN only:
-
Start
spark-shell
Spark’s shell provides an interactive shell to learn the Spark API.
It is available in either Scala (spark-shell) or Python (pyspark).
Default Spark Session configuration:
-
spark-shell
commands help
-
spark-shell
default import
spark-shell
will automatically import some packages.
To list the imported packages use the command :imports
:
-
spark-shell
default variables
spark-shell
will create automatically an instance of Spark Session (accessible using spark
variable)
and an instance of Spark Context (accessible using sc
variable).
► Spark Session available as "spark
".
► Spark Context available as "sc
".
Spark Session variable:
Spark Context variable:
You can use auto-completion (tab key) to get available options:
-
Running Linux commands
First start by by importing the package sys.process._
.
To run a Linux command, just wrap it in double quotes followed by a dot and exclamation characters .!