-
Notifications
You must be signed in to change notification settings - Fork 11
Getting Started With EclairJS Nashorn
EclairJS Nashorn is part of the EclairJS project and is being developed in parallel with EclairJS Node.
The purpose of EclairJS Nashorn is to expose the Apache Spark programming model to JavaScript. It consists of an interpreter which instantiates Nashorn, resolves Spark Java method references and initiates code evaluation and also a Java wrapper which, along with Nashorn, execute lambda functions and handle type conversions on Worker nodes.
EclairJS Nashorn can be used independently from EclairJS Node.
Build the Nashorn JAR as specified in the README. Once built, you can use the Nashorn JAR in the following three ways:
- As mentioned in the README on the main page you can use the eclairJS script to:
- Run a simple example to count words:
bin/eclairJS examples/word_count.jsor
- To enter REPL mode:
bin/eclairJS
eclairJS>var conf = new SparkConf().setAppName("Sample App").setMaster("local[*]");
var sparkContext = new SparkContext(conf);-
If you are comfortable with using notebooks, you can follow the section on Usage with Jupyter Notebooks in the README for this project to start to explore the EclairJS Nashorn API and work with Apache Spark through JavaScript.
-
Finally, you can use the EclairJS Nashorn Jar with EclairJS Node, the other component to EclairJS.