[
https://issues.apache.org/jira/browse/FLINK-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14207852#comment-14207852
]
ASF GitHub Bot commented on FLINK-1230:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/incubator-flink/pull/195#discussion_r20208180
--- Diff: docs/local_execution.md ---
@@ -56,26 +59,40 @@ public static void main(String[] args) throws Exception
{
~~~
-## Local Executor
-
-The *LocalExecutor* is similar to the local environment, but it takes a
*Plan* object, which describes the program as a single executable unit. The
*LocalExecutor* is typically used with the Scala API.
+## Local Execution on Java Collections
-The following code shows how you would use the `LocalExecutor` with the
Wordcount example for Scala Programs:
+The execution on Java Collections is a low-overhead approach for executing
Flink programs. Typical use-cases for this mode are automated tests, debugging
and code re-use.
-~~~scala
-public static void main(String[] args) throws Exception {
- val input = TextFile("hdfs://path/to/file")
+Users can use algorithms implemented for batch processing with Flink for
also for cases that are more interactive. A slightly changed variant of a Flink
program could be used in a Java Application Server for processing incoming
requests.
- val words = input flatMap { _.toLowerCase().split("""\W+""") filter {
_ != "" } }
- val counts = words groupBy { x => x } count()
+**Skeleton for Collection-based execution**
- val output = counts.write(wordsOutput, CsvOutputFormat())
-
- val plan = new ScalaPlan(Seq(output), "Word Count")
- LocalExecutor.executePlan(p);
+~~~java
+public static void main(String[] args) throws Exception {
+ // initialize a new Collection-based execution environment
+ final ExecutionEnvironment env = new CollectionEnvironment();
+
+ DataSet<User> users = env.fromCollection( /* get elements from a Java
Collection */);
+
+ /* Data Set transformations ... */
+
+ // retrieve the resulting Tuple2 elements into a ArrayList.
+ Collection<...> result = new ArrayList<...>();
+ resultDataSet.output(new LocalCollectionOutputFormat<...>(result));
+
+ // kick off execution.
+ env.execute();
+
+ // Do some work with the resulting ArrayList (=Collection).
+ for(... t : result) {
+ System.err.println("Result = "+t);
+ }
}
~~~
+Please note that the execution of Flink programs is only possible on small
data, fitting into the JVM heap.
--- End diff --
Execution is also single-threaded.
> Add embedded collection execution to documentation
> --------------------------------------------------
>
> Key: FLINK-1230
> URL: https://issues.apache.org/jira/browse/FLINK-1230
> Project: Flink
> Issue Type: Improvement
> Components: Documentation
> Affects Versions: 0.8-incubating, 0.7.1-incubating
> Reporter: Stephan Ewen
> Assignee: Robert Metzger
> Fix For: 0.8-incubating
>
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)