私はSparkを初めて使用していて、Sparkシェルをどのように使用するのか把握しようとしています。スパークシェルのコマンドライン
Sparkのサイトのドキュメントを参照し、ディレクトリの作成方法やsparkシェル内のすべてのファイルを表示する方法を示していません。もし誰かが私を助けることができたら、私はそれを感謝します。
私はSparkを初めて使用していて、Sparkシェルをどのように使用するのか把握しようとしています。スパークシェルのコマンドライン
Sparkのサイトのドキュメントを参照し、ディレクトリの作成方法やsparkシェル内のすべてのファイルを表示する方法を示していません。もし誰かが私を助けることができたら、私はそれを感謝します。
この文脈では、Sparkシェルは普通のScala REPLだと仮定することができますので、同じ規則が適用されます。利用可能なコマンドのリストは、:help
を使用して取得できます。
Welcome to
____ __
/__/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 2.3.0
/_/
Using Scala version 2.11.8 (OpenJDK 64-Bit Server VM, Java 1.8.0_151)
Type in expressions to have them evaluated.
Type :help for more information.
scala> :help
All commands can be abbreviated, e.g., :he instead of :help.
:edit <id>|<line> edit history
:help [command] print this summary or command-specific help
:history [num] show the history (optional num is commands to show)
:h? <string> search the history
:imports [name name ...] show import history, identifying sources of names
:implicits [-v] show the implicits in scope
:javap <path|class> disassemble a file or class name
:line <id>|<line> place line(s) at the end of history
:load <path> interpret lines in a file
:paste [-raw] [path] enter paste mode or paste a file
:power enable power user mode
:quit exit the interpreter
:replay [options] reset the repl and replay all previous commands
:require <path> add a jar to the classpath
:reset [options] reset the repl to its initial state, forgetting all session entries
:save <path> save replayable session to a file
:sh <command line> run a shell command (result is implicitly => List[String])
:settings <options> update compiler options, if possible; see reset
:silent disable/enable automatic printing of results
:type [-v] <expr> display the type of an expression without evaluating it
:kind [-v] <expr> display the kind of expression's type
:warnings show the suppressed warnings from the most recent line which had any
上記のように、:sh
を使用してシェルコマンドを呼び出すことができます。たとえば、次のように
scala> :sh mkdir foobar
res0: scala.tools.nsc.interpreter.ProcessResult = `mkdir foobar` (0 lines, exit 0)
scala> :sh touch foobar/foo
res1: scala.tools.nsc.interpreter.ProcessResult = `touch foobar/foo` (0 lines, exit 0)
scala> :sh touch foobar/bar
res2: scala.tools.nsc.interpreter.ProcessResult = `touch foobar/bar` (0 lines, exit 0)
scala> :sh ls foobar
res3: scala.tools.nsc.interpreter.ProcessResult = `ls foobar` (2 lines, exit 0)
scala> res3.line foreach println
line lines
scala> res3.lines foreach println
bar
foo
Click for image description here
:qまたは:quitコマンドは、Scalaのリップルを終了するために使用されます。 ?SH LS res5:scala.tools.nsc.interpreter.ProcessResult = `ls`(2行、終了0)` `スカーラ> res5 foreachの任意のアイデアなぜ`スカラ> - 私はこの奇妙なエラーが出る
' println':12:エラー:値のforeachはscala.tools.nsc.interpreter.ProcessResult' ' res5 foreachのprintln' –
WoodChopper
WoodChopperだけで行う 'res5.lines foreachのprintln' –
' RES3のforeach println'のメンバーではありません代わりに 'res3.lines foreach println'する必要があります。 –