Skip to content

Commit

Permalink
clean files
Browse files Browse the repository at this point in the history
  • Loading branch information
kamir committed Sep 8, 2024
1 parent 6f21676 commit c73578a
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 44 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Apache Wayang (incubating) can be used via the following APIs:

## Quick Guide for Running Wayang

For a quick guide on how to run org.apache.wayang.examples.WordCount see [here](guides/tutorial.md).
For a quick guide on how to run WordCount see [here](guides/tutorial.md).

## Quick Guide for Developing with Wayang

Expand Down
30 changes: 24 additions & 6 deletions env_template.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
export BOOTSTRAP_SERVER=pkc-75m1o.europe-west3.gcp.confluent.cloud:9092
export CLUSTER_API_KEY=4UHO44F3C5REE4GQ
export CLUSTER_API_SECRET=+ItHijlhTyclRL0aQb/xr0QwnR1H+k6fSFUyPy26XmkBgiy2Tfvmz5oxRgqyKdSL
export SR_ENDPOINT=https://psrc-lo5k9.eu-central-1.aws.confluent.cloud
export SR_API_KEY=KRUBMHQAX4GV7Y5V
export SR_API_SECRET=ZHZSa/1Rqm+1+e3bMfo+D6hjbmxm6bV5CjKcSetf+83P/ReG2l5PzFAGV2CGg4AC
#!/usr/bin/env bash

#
# 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.
#
export BOOTSTRAP_SERVER=...
export CLUSTER_API_KEY=...
export CLUSTER_API_SECRET=...
export SR_ENDPOINT=...
export SR_API_KEY=...
export SR_API_SECRET=...

export SPARK_HOME=/opt/homebrew/Cellar/apache-spark/3.5.2/libexec
export HADOOP_HOME=/opt/homebrew/Cellar/hadoop/3.4.0/libexec
Expand Down
8 changes: 4 additions & 4 deletions guides/develop-with-Wayang.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ This tutorial shows users how to import Wayang in their Java project using the m
```
A sample pom file can be found [here](pom-example.xml).

# Test org.apache.wayang.examples.WordCount
# 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)

Expand All @@ -85,8 +85,8 @@ public static void main(String[] args) {

/* Get a plan builder */
JavaPlanBuilder planBuilder = new JavaPlanBuilder(wayangContext)
.withJobName("org.apache.wayang.examples.WordCount")
.withUdfJarOf(org.apache.wayang.examples.WordCount.class);
.withJobName("WordCount")
.withUdfJarOf(WordCount.class);

/* Start building the Apache WayangPlan */
Collection<Tuple2<String, Integer>> wordcounts = planBuilder
Expand Down Expand Up @@ -119,4 +119,4 @@ public static void main(String[] args) {
System.out.println(wordcounts);
}
```
A sample Java class file can be found [here](org.apache.wayang.examples.WordCount.java).
A sample Java class file can be found [here](WordCount.java).
2 changes: 1 addition & 1 deletion guides/ml-in-Wayang.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class CustomEstimatableCost implements EstimatableCost {
* by implementing the interface in this class.
*/
}
public class org.apache.wayang.examples.WordCount {
public class WordCount {
public static void main(String[] args) {
/* Create a Wayang context and specify the platforms Wayang will consider */
Configuration config = new Configuration();
Expand Down
4 changes: 2 additions & 2 deletions guides/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
limitations under the License.
-->
This tutorial will show users how to run the org.apache.wayang.examples.WordCount example locally with Wayang.
This tutorial will show users how to run the WordCount example locally with Wayang.

# Clone repository
```shell
Expand Down Expand Up @@ -57,7 +57,7 @@ source ~/.zshrc

# Run the program

To execute the org.apache.wayang.examples.WordCount example with Apache Wayang, you need to execute your program with the 'wayang-submit' command:
To execute the WordCount example with Apache Wayang, you need to execute your program with the 'wayang-submit' command:

```shell
cd wayang-0.7.1-SNAPSHOT
Expand Down
8 changes: 4 additions & 4 deletions guides/wayang-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
-->
This page contains examples to be executed using Wayang.
- [org.apache.wayang.examples.WordCount](#wordcount)
- [WordCount](#wordcount)
* [Java scala-like API](#java-scala-like-api)
* [Scala API](#scala-api)
- [k-means](#k-means)
* [Scala API](#scala-api-1)

## org.apache.wayang.examples.WordCount
## WordCount

The "Hello World!" of data processing systems is the wordcount.

Expand Down Expand Up @@ -51,7 +51,7 @@ public class WordcountJava {
.withPlugin(Java.basicPlugin())
.withPlugin(Spark.basicPlugin());
JavaPlanBuilder planBuilder = new JavaPlanBuilder(wayangContext)
.withJobName(String.format("org.apache.wayang.examples.WordCount (%s)", inputUrl))
.withJobName(String.format("WordCount (%s)", inputUrl))
.withUdfJarOf(WordcountJava.class);

// Start building the WayangPlan.
Expand Down Expand Up @@ -107,7 +107,7 @@ object WordcountScala {
.withPlugin(Java.basicPlugin)
.withPlugin(Spark.basicPlugin)
val planBuilder = new PlanBuilder(wayangContext)
.withJobName(s"org.apache.wayang.examples.WordCount ($inputUrl)")
.withJobName(s"WordCount ($inputUrl)")
.withUdfJarsOf(this.getClass)

val wordcounts = planBuilder
Expand Down
6 changes: 3 additions & 3 deletions wayang-api/wayang-api-scala-java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ import org.apache.wayang.core.api.Configuration
import org.apache.wayang.java.Java
import org.apache.wayang.spark.Spark

class org.apache.wayang.examples.WordCount {}
class WordCount {}

object org.apache.wayang.examples.WordCount {
object WordCount {

def main(args: Array[String]): Unit = {
println("org.apache.wayang.examples.WordCount")
println("WordCount")
println("Scala version:")
println(scala.util.Properties.versionString)

Expand Down
2 changes: 2 additions & 0 deletions wayang-applications/bin/env_template.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
Expand All @@ -15,4 +16,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

export JAVA_HOME=....
17 changes: 6 additions & 11 deletions wayang-applications/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
<DATA_REPO_001>file://${project.basedir}/wayang-applications/data/case-study/DATA_REPO_001</DATA_REPO_001>
<DATA_REPO_002>https://kamir.solidcommunity.net/public/ecolytiq-sustainability-profile</DATA_REPO_002>
<DIST_WAYANG_HOME>${project.basedir}/../wayang-assembly/target/apache-wayang-assembly-0.7.1-incubating-dist/wayang-0.7.1</DIST_WAYANG_HOME>
<WAYANG_VERSION>0.7.1</WAYANG_VERSION>

<wayang.version>0.7.1</wayang.version>
<spark.version>3.5.0</spark.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
Expand All @@ -62,29 +62,27 @@
<dependency>
<groupId>org.apache.wayang</groupId>
<artifactId>wayang-core</artifactId>
<version>${WAYANG_VERSION}</version>
<version>${wayang.version}</version>
</dependency>
<dependency>
<groupId>org.apache.wayang</groupId>
<artifactId>wayang-basic</artifactId>
<version>${WAYANG_VERSION}</version>
<version>${wayang.version}</version>
</dependency>
<dependency>
<groupId>org.apache.wayang</groupId>
<artifactId>wayang-java</artifactId>
<version>${WAYANG_VERSION}</version>
<version>${wayang.version}</version>
</dependency>
<dependency>
<groupId>org.apache.wayang</groupId>
<artifactId>wayang-spark</artifactId>
<version>${WAYANG_VERSION}</version>
<version>${wayang.version}</version>
</dependency>
<dependency>
<groupId>org.apache.wayang</groupId>
<artifactId>wayang-api-scala-java</artifactId>
<version>${WAYANG_VERSION}</version>
<!--scope>system</scope-->
<!--systemPath>/Users/kamir/GITHUB.merge/incubator-wayang/wayang-assembly/target/apache-wayang-assembly-0.7.1-incubating-dist/wayang-0.7.1/jars/wayang-api-scala-java-0.7.1.jar</systemPath-->
<version>${wayang.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
Expand Down Expand Up @@ -130,9 +128,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<!--configuration>
<outputDirectory>/opt/homebrew/opt/apache-spark/jars</outputDirectory>
</configuration-->
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,5 @@ public class OutputSerializer implements SerializableFunction<Tuple2<String, Int
public String apply(Tuple2<String, Integer> tuple) {
return tuple.getField0() + ": " + tuple.getField1();
}

// Example usage within a main method or similar test environment
public static void main(String[] args) {
OutputSerializer formatter = new OutputSerializer();
Tuple2<String, Integer> exampleTuple = new Tuple2<>("Age", 30);
String result = formatter.apply(exampleTuple);
System.out.println(result); // Output: Age: 30
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static void main(String[] args){
.withPlugin(Java.basicPlugin());
// .withPlugin(Spark.basicPlugin());
JavaPlanBuilder planBuilder = new JavaPlanBuilder(wayangContext)
.withJobName(String.format("org.apache.wayang.examples.WordCount (%s)", inputUrl))
.withJobName(String.format("WordCount (%s)", inputUrl))
.withUdfJarOf(WordCount.class);

// Start building the WayangPlan.
Expand Down
6 changes: 3 additions & 3 deletions wayang-docs/src/main/resources/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ This tool will attempt to determine suitable values for the question marks (`?`)
For some executable examples, have a look at [this repository](https://github.com/sekruse/rheem-examples).
### org.apache.wayang.examples.WordCount
### WordCount
#### Java API
```java
Expand All @@ -198,7 +198,7 @@ public class WordcountJava {
.withPlugin(Java.basicPlugin())
.withPlugin(Spark.basicPlugin());
JavaPlanBuilder planBuilder = new JavaPlanBuilder(wayangContext)
.withJobName(String.format("org.apache.wayang.examples.WordCount (%s)", inputUrl))
.withJobName(String.format("WordCount (%s)", inputUrl))
.withUdfJarOf(WordcountJava.class);
// Start building the WayangPlan.
Expand Down Expand Up @@ -254,7 +254,7 @@ object WordcountScala {
.withPlugin(Java.basicPlugin)
.withPlugin(Spark.basicPlugin)
val planBuilder = new PlanBuilder(wayangContext)
.withJobName(s"org.apache.wayang.examples.WordCount ($inputUrl)")
.withJobName(s"WordCount ($inputUrl)")
.withUdfJarsOf(this.getClass)
val wordcounts = planBuilder
Expand Down

0 comments on commit c73578a

Please sign in to comment.