Resolved merge conflict in readme.
diff --git a/README.md b/README.md
index e909836..afb2c1a 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,6 @@
# Apache Wayang (incubating) <img align="right" width="128px" src="https://wayang.apache.org/assets/img/logo/logo_400x160.png" alt="Wayang logo">
-#### The first cross-platform data processing system
+
+## The first open-source cross-platform data processing system
[![Maven central](https://img.shields.io/maven-central/v/org.apache.wayang/wayang-core.svg?style=for-the-badge)](https://img.shields.io/maven-central/v/org.apache.wayang/wayang-core.svg)
[![License](https://img.shields.io/github/license/apache/incubator-wayang.svg?style=for-the-badge)](http://www.apache.org/licenses/LICENSE-2.0)
@@ -30,9 +31,13 @@
- Scala
- SQL (limited support of simple select-project queries for now)
-## Quick Guide
+## Quick Guide for Running Wayang
-For a guide on how to quickly run WordCount see [here](tutorial.md).
+For a quick guide on how to run WordCount see [here](guides/tutorial.md).
+
+## Quick Guide for Developing with Wayang
+
+For a quick guide on how to use Wayang in your Java/Scala project see [here](guides/develop-with-Wayang.md).
## Installing Wayang
@@ -77,10 +82,10 @@
Wayang is available via Maven Central. To use it with Maven, include the following code snippet into your POM file:
```xml
-<dependency>
+<dependency>
<groupId>org.apache.wayang</groupId>
<artifactId>wayang-***</artifactId>
- <version>0.6.0</version>
+ <version>0.6.0</version>
</dependency>
```
Note the `***`: Wayang ships with multiple modules that can be included in your app, depending on how you want to use it:
diff --git a/guides/WordCount.java b/guides/WordCount.java
new file mode 100644
index 0000000..86250fb
--- /dev/null
+++ b/guides/WordCount.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package test;
+
+import org.apache.wayang.api.JavaPlanBuilder;
+import org.apache.wayang.basic.data.Tuple2;
+import org.apache.wayang.core.api.Configuration;
+import org.apache.wayang.core.api.WayangContext;
+import org.apache.wayang.core.optimizer.cardinality.DefaultCardinalityEstimator;
+import org.apache.wayang.java.Java;
+import org.apache.wayang.spark.Spark;
+
+import java.util.Collection;
+import java.util.Arrays;
+
+public class WordCount {
+
+ public static void main(String[] args) {
+
+ /* Create a Wayang context and specify the platforms Wayang will consider */
+ 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);
+ }
+}
+
diff --git a/guides/develop-with-Wayang.md b/guides/develop-with-Wayang.md
new file mode 100644
index 0000000..ca7a750
--- /dev/null
+++ b/guides/develop-with-Wayang.md
@@ -0,0 +1,122 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+This tutorial shows users how to import Wayang in their Java project using the maven.
+
+# Include the Wayang maven dependencies in your pom
+```shell
+ <dependency>
+ <groupId>org.apache.wayang</groupId>
+ <artifactId>wayang-core</artifactId>
+ <version>0.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wayang</groupId>
+ <artifactId>wayang-basic</artifactId>
+ <version>0.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wayang</groupId>
+ <artifactId>wayang-java</artifactId>
+ <version>0.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wayang</groupId>
+ <artifactId>wayang-spark_2.12</artifactId>
+ <version>0.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wayang</groupId>
+ <artifactId>wayang-api-scala-java_2.12</artifactId>
+ <version>0.6.0</version>
+ </dependency>
+```
+
+# Include the Spark maven dependencies in your pom
+```shell
+ <dependency>
+ <groupId>org.apache.spark</groupId>
+ <artifactId>spark-core_2.12</artifactId>
+ <version>${spark.version}</version>
+ </dependency>
+```
+
+# Other maven dependencies to consider
+```shell
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>2.12.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.7.13</version>
+ </dependency>
+```
+A sample pom file can be found [here](pom-example.xml).
+
+# Test WordCount
+## Create a Java class that contains the main method that runs the Wordcount
+Here is a sample implementation getting as input the filename (e.g., file:/Projects/Wayang/test.txt)
+
+```shell
+public static void main(String[] args) {
+
+ /* Create a Wayang context and specify the platforms Wayang will consider */
+ 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);
+}
+```
+A sample Java class file can be found [here](WordCount.java).
diff --git a/guides/pom-example.xml b/guides/pom-example.xml
new file mode 100644
index 0000000..bdf2ce3
--- /dev/null
+++ b/guides/pom-example.xml
@@ -0,0 +1,98 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+<!-- Sample pom file for using Wayang in a Java/scala project -->
+
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <properties>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ <spark.version>3.1.2</spark.version>
+ </properties>
+
+ <groupId>org.example</groupId>
+ <artifactId>wayang-test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <repositories>
+ <repository>
+ <id>apache-snapshots</id>
+ <url>https://repository.apache.org/content/repositories/snapshots</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.wayang</groupId>
+ <artifactId>wayang-core</artifactId>
+ <version>0.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wayang</groupId>
+ <artifactId>wayang-basic</artifactId>
+ <version>0.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wayang</groupId>
+ <artifactId>wayang-java</artifactId>
+ <version>0.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wayang</groupId>
+ <artifactId>wayang-spark_2.12</artifactId>
+ <version>0.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wayang</groupId>
+ <artifactId>wayang-api-scala-java_2.12</artifactId>
+ <version>0.6.0</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.spark</groupId>
+ <artifactId>spark-core_2.12</artifactId>
+ <version>${spark.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>2.12.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.7.13</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tutorial.md b/guides/tutorial.md
similarity index 100%
rename from tutorial.md
rename to guides/tutorial.md