guides/WordCount.java [37:74]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        WayangContext wayangContext = new WayangContext(new Configuration())
                .withPlugin(Java.basicPlugin())
                .withPlugin(Spark.basicPlugin());
        
        /* Get a plan builder */
        JavaPlanBuilder planBuilder = new JavaPlanBuilder(wayangContext)
                .withJobName("WordCount")
                .withUdfJarOf(WordCount.class);

        /* Start building the Apache WayangPlan */
        Collection<Tuple2<String, Integer>> wordcounts = planBuilder
                /* Read the text file */
                .readTextFile(args[0]).withName("Load file")

                /* Split each line by non-word characters */
                .flatMap(line -> Arrays.asList(line.split("\\W+")))
                .withName("Split words")

                /* Filter empty tokens */
                .filter(token -> !token.isEmpty())
                .withName("Filter empty words")
                /* you can also specify the desired platform per operator */
                //.withTargetPlatform(Java.platform())

                /* Attach counter to each word */
                .map(word -> new Tuple2<>(word.toLowerCase(), 1)).withName("To lower case, add counter")

                /* Sum up counters for every word. */
                .reduceByKey(
                        Tuple2::getField0,
                        (t1, t2) -> new Tuple2<>(t1.getField0(), t1.getField1() + t2.getField1())
                )
                .withName("Add counters")

                /* Execute the plan and collect the results */
                .collect();

        System.out.println(wordcounts);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



wayang-benchmark/src/main/java/org/apache/wayang/apps/wordcount/WordCount.java [42:78]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
         WayangContext wayangContext = new WayangContext(new Configuration())
                 .withPlugin(Java.basicPlugin())
                 .withPlugin(Spark.basicPlugin());
 //                .withPlugin(Flink.basicPlugin());
 
         JavaPlanBuilder planBuilder = new JavaPlanBuilder(wayangContext)
                 .withJobName("WordCount")
                 .withUdfJarOf(WordCount.class);
 
         /* Start building the Apache WayangPlan */
         Collection<Tuple2<String, Integer>> wordcounts = planBuilder
                 /* Read the text file */
                 .readTextFile(args[0]).withName("Load file")
 
                 /* Split each line by non-word characters */
                 .flatMap(line -> Arrays.asList(line.split("\\W+")))
 //                .withSelectivity(1, 100, 0.9)
                 .withName("Split words")
 
                 /* Filter empty tokens */
                 .filter(token -> !token.isEmpty())
                 .withName("Filter empty words")
 
                 /* Attach counter to each word */
                 .map(word -> new Tuple2<>(word.toLowerCase(), 1)).withName("To lower case, add counter")
 
                 // Sum up counters for every word.
                 .reduceByKey(
                         Tuple2::getField0,
                         (t1, t2) -> new Tuple2<>(t1.getField0(), t1.getField1() + t2.getField1())
                 )
                 .withName("Add counters")
 
                 /* Execute the plan and collect the results */
                 .collect();
 
         System.out.println(wordcounts);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



