Author: bertty
Date: Fri Nov 26 17:07:22 2021
New Revision: 51106
Log:
Apache Wayang (incubating) RC8
Added:
dev/incubator/wayang/0.6.0/rc8/
dev/incubator/wayang/0.6.0/rc8/DISCLAIMER
dev/incubator/wayang/0.6.0/rc8/LICENSE
dev/incubator/wayang/0.6.0/rc8/NOTICE
dev/incubator/wayang/0.6.0/rc8/README.md
dev/incubator/wayang/0.6.0/rc8/RELEASE_NOTES
dev/incubator/wayang/0.6.0/rc8/apache-wayang-0.6.0-incubating-source-release.zip
(with props)
dev/incubator/wayang/0.6.0/rc8/apache-wayang-0.6.0-incubating-source-release.zip.asc
dev/incubator/wayang/0.6.0/rc8/apache-wayang-0.6.0-incubating-source-release.zip.sha512
Added: dev/incubator/wayang/0.6.0/rc8/DISCLAIMER
==============================================================================
--- dev/incubator/wayang/0.6.0/rc8/DISCLAIMER (added)
+++ dev/incubator/wayang/0.6.0/rc8/DISCLAIMER Fri Nov 26 17:07:22 2021
@@ -0,0 +1,7 @@
+Apache Wayang (incubating) is an effort undergoing incubation at The Apache
Software
+Foundation (ASF), sponsored by the Apache Incubator PMC. Incubation is required
+of all newly accepted projects until a further review indicates that the
+infrastructure, communications, and decision making process have stabilized in
+a manner consistent with other successful ASF projects. While incubation status
+is not necessarily a reflection of the completeness or stability of the code,
+it does indicate that the project has yet to be fully endorsed by the ASF.
Added: dev/incubator/wayang/0.6.0/rc8/LICENSE
==============================================================================
--- dev/incubator/wayang/0.6.0/rc8/LICENSE (added)
+++ dev/incubator/wayang/0.6.0/rc8/LICENSE Fri Nov 26 17:07:22 2021
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
Added: dev/incubator/wayang/0.6.0/rc8/NOTICE
==============================================================================
--- dev/incubator/wayang/0.6.0/rc8/NOTICE (added)
+++ dev/incubator/wayang/0.6.0/rc8/NOTICE Fri Nov 26 17:07:22 2021
@@ -0,0 +1,13 @@
+Apache Wayang (incubating)
+Copyright 2020 - 2021 The Apache Software Foundation.
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+--
+This product includes software from Sebastian Kruse
+Copyright 2016 Sebastian Kruse, Licensed under the Apache License, Version 2.0
+https://github.com/sekruse/profiledb-java.git
+The adjusted code can be found in wayang-commons/wayang-utils-profile-db/src/
+More details in wayang-commons/wayang-utils-profile-db/NOTICE
+--
Added: dev/incubator/wayang/0.6.0/rc8/README.md
==============================================================================
--- dev/incubator/wayang/0.6.0/rc8/README.md (added)
+++ dev/incubator/wayang/0.6.0/rc8/README.md Fri Nov 26 17:07:22 2021
@@ -0,0 +1,381 @@
+# Apache Wayang (incubating) <img align="right" width="128px"
src="https://wayang.apache.org/assets/img/logo/logo_400x160.png" alt="Wayang
logo">
+
+[](https://img.shields.io/maven-central/v/org.apache.wayang/wayang-core.svg)
+[](http://www.apache.org/licenses/LICENSE-2.0)
+[]()
+
+
+
+
+#### The first cross-platform data processing system
+
+In contrast to traditional data processing systems that provide one dedicated
execution engine, Apache Wayang (incubating) is a *cross-platform data
processing system*: Users can specify any data processing application using one
of Wayang's API and then Wayang will choose the data processing platform(s),
e.g., Postgres or Apache Spark, that best fits the application. Finally, Wayang
will perform the execution, thereby hiding the different platform-specific APIs
and coordinating inter-platform communication.
+
+Apache Wayang (incubating) aims at freeing data engineers and software
developers from the burden of learning all different data processing systems,
their APIs, strengths and weaknesses; the intricacies of coordinating and
integrating different processing platforms; and the inflexibility when trying a
fixed set of processing platforms. As of now, Wayang has built-in support for
the following processing platforms:
+- [Java
Streams](https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html)
+- [Apache Spark](https://spark.apache.org/)
+- [Apache Flink](https://flink.apache.org/)
+- [Apache Giraph](https://giraph.apache.org/)
+- [GraphChi](https://github.com/GraphChi/graphchi-java)
+- [Postgres](http://www.postgresql.org)
+- [SQLite](https://www.sqlite.org/)
+
+## How to use Wayang
+
+**Requirements.**
+Apache Wayang (incubating) is built with Java 8 and Scala 2.11. However, to
execute Wayang it is sufficient to have Java 8 installed. If you want to build
Wayang yourself, you will also need to have [Apache
Maven](http://maven.apache.org) installed and Apache Hadoop (the version that
you want). Please also consider that processing platforms employed by Wayang
might have further requirements.
+
+> **NOTE:** In windows, you need to define the variable `HADOOP_HOME` with the
winutils.exe, an not official option to obtain [this
repository](https://github.com/steveloughran/winutils), or you can generate
your winutils.exe following the instructions in the repository. Also, you may
need to install
[msvcr100.dll](https://www.microsoft.com/en-us/download/details.aspx?id=26999)
+
+> **NOTE:** Currently Apache Wayang (incubating) is updating Java and Scala,
consider that to be able to utilize Scala 2.12 you will need to install Java 11
in your enviroment
+
+**Get Wayang.**
+Wayang is available via Maven Central. To use it with Maven, for instance,
include the following into you POM file:
+```xml
+<dependency>â¨
+ <groupId>org.apache.wayang</groupId>
+ <artifactId>wayang-***</artifactId>
+ <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:
+* `wayang-core`: provides core data structures and the optimizer (required)
+* `wayang-basic`: provides common operators and data types for your apps
(recommended)
+* `wayang-api`: provides an easy-to-use Scala and Java API to assemble Wayang
plans (recommended)
+* `wayang-java`, `wayang-spark`, `wayang-graphchi`, `wayang-sqlite3`,
`wayang-postgres`: adapters for the various supported processing platforms
+* `wayang-profiler`: provides functionality to learn operator and UDF cost
functions from historical execution data
+
+For the sake of version flexibility, you still have to include your Hadoop
(`hadoop-hdfs` and `hadoop-common`) and Spark (`spark-core` and `spark-graphx`)
version of choice.
+
+In addition, you can obtain the most recent snapshot version of Wayang via
Sonatype's snapshot repository. Just included
+```xml
+<repositories>
+ <repository>
+ <id>apache-snapshots</id>
+ <name>Apache Foundation Snapshot Repository</name>
+ <url>https://repository.apache.org/content/repositories/snapshots</url>
+ </repository>
+<repositories>
+```
+
+If you need to rebuild Wayang, e.g., to use a different Scala version, you can
simply do so via Maven:
+
+1. Adapt the version variables (e.g., `spark.version`) in the main `pom.xml`
file.
+2. Build Wayang with the adapted versions.
+ ```shell
+ $ mvn clean install
+ ```
+> **NOTE:** In current maven setup the version of scala are tie to the Java
version, you can compile the profile `scala-11` with Java 8 and profile
`scala-12` with Java 11
+
+> **NOTE:** For compiling the code and testing the code it required to have
installed hadoop in your machine
+
+> **NOTE:** the `standalone` profile to fix Hadoop and Spark versions, so
that Wayang apps do not explicitly need to declare the corresponding
dependencies.
+>
+> Also, note the `distro` profile, which assembles a binary Wayang
distribution.
+To activate these profiles, you need to specify them when running maven, i.e.,
+
+```shell
+mvn clean install -P<profile name>
+```
+
+**Configure Wayang.** In order for Wayang to work properly, it is necessary to
tell Wayang about the capacities of your processing platforms and how to reach
them. While there is a default configuration that allows to test Wayang right
away, we recommend to create a properties file to adapt the configuration where
necessary. To have Wayang use that configuration transparently, just run you
app via
+```shell
+$ java -Dwayang.configuration=url://to/my/wayang.properties ...
+```
+
+You can find the most relevant settings in the following:
+* General settings
+ * `wayang.core.log.enabled (= true)`: whether to log execution statistics to
allow learning better cardinality and cost estimators for the optimizer
+ * `wayang.core.log.executions (= ~/.wayang/executions.json)` where to log
execution times of operator groups
+ * `wayang.core.log.cardinalities (= ~/.wayang/cardinalities.json)` where to
log cardinality measurements
+ * `wayang.core.optimizer.instrumentation (=
org.apache.wayang.core.profiling.OutboundInstrumentationStrategy)`: where to
measure cardinalities in Wayang plans; other options are
`org.apache.wayang.core.profiling.NoInstrumentationStrategy` and
`org.apache.wayang.core.profiling.FullInstrumentationStrategy`
+ * `wayang.core.optimizer.reoptimize (= false)`: whether to progressively
optimize Wayang plans
+ * `wayang.basic.tempdir (= file:///tmp)`: where to store temporary files, in
particular for inter-platform communication
+* Java Streams
+ * `wayang.java.cpu.mhz (= 2700)`: clock frequency of processor the JVM runs
on in MHz
+ * `wayang.java.hdfs.ms-per-mb (= 2.7)`: average throughput from HDFS to JVM
in ms/MB
+* Apache Spark
+ * `spark.master (= local)`: Spark master
+ * various other Spark settings are supported, e.g.,
`spark.executor.memory`, `spark.serializer`, ...
+ * `wayang.spark.cpu.mhz (= 2700)`: clock frequency of processor the Spark
workers run on in MHz
+ * `wayang.spark.hdfs.ms-per-mb (= 2.7)`: average throughput from HDFS to the
Spark workers in ms/MB
+ * `wayang.spark.network.ms-per-mb (= 8.6)`: average network throughput of
the Spark workers in ms/MB
+ * `wayang.spark.init.ms (= 4500)`: time it takes Spark to initialize in ms
+* GraphChi
+ * `wayang.graphchi.cpu.mhz (= 2700)`: clock frequency of processor GraphChi
runs on in MHz
+ * `wayang.graphchi.cpu.cores (= 2)`: number of cores GraphChi runs on
+ * `wayang.graphchi.hdfs.ms-per-mb (= 2.7)`: average throughput from HDFS to
GraphChi in ms/MB
+* SQLite
+ * `wayang.sqlite3.jdbc.url`: JDBC URL to use SQLite
+ * `wayang.sqlite3.jdbc.user`: optional user name
+ * `wayang.sqlite3.jdbc.password`: optional password
+ * `wayang.sqlite3.cpu.mhz (= 2700)`: clock frequency of processor SQLite
runs on in MHz
+ * `wayang.sqlite3.cpu.cores (= 2)`: number of cores SQLite runs on
+* PostgreSQL
+ * `wayang.postgres.jdbc.url`: JDBC URL to use PostgreSQL
+ * `wayang.postgres.jdbc.user`: optional user name
+ * `wayang.postgres.jdbc.password`: optional password
+ * `wayang.postgres.cpu.mhz (= 2700)`: clock frequency of processor
PostgreSQL runs on in MHz
+ * `wayang.postgres.cpu.cores (= 2)`: number of cores PostgreSQL runs on
+
+**Code with Wayang.** The recommended way to specify your apps with Wayang is
via its Scala or Java API from the `wayang-api` module. You can find examples
below.
+
+**Learn cost functions.**
+Wayang provides a utility to learn cost functions from historical execution
data.
+Specifically, Wayang can learn configurations for load profile estimators
(that estimate CPU load, disk load etc.) for both operators and UDFs, as long
as the configuration provides a template for those estimators.
+As an example, the `JavaMapOperator` draws its load profile estimator
configuration via the configuration key `wayang.java.map.load`.
+Now, it is possible to specify a load profile estimator template in the
configuration under the key `<original key>.template`, e.g.:
+```xml
+wayang.java.map.load.template = {\
+ "in":1, "out":1,\
+ "cpu":"?*in0"\
+}
+```
+This template specifies a load profile estimator that expects (at least) one
input cardinality and one output cardinality.
+Further, it models a CPU load that is proportional to the input cardinality.
+However, more complex functions are possible.
+In particular, you can use
+* the variables `in0`, `in1`, ... and `out0`, `out1`, ... to incorporate the
input and output cardinalities, respectively;
+* operator properties, such as `numIterations` for the `PageRankOperator`
implementations;
+* the operators `+`, `-`, `*`, `/`, `%`, `^`, and parantheses;
+* the functions `min(x0, x1, ...))`, `max(x0, x1, ...)`, `abs(x)`, `log(x,
base)`, `ln(x)`, `ld(x)`;
+* and the constants `e` and `pi`.
+
+While Wayang specifies templates for all execution operators, you will need to
specify that your UDFs are modelled by some configuration-based cost function
(see the k-means example below) and create the according initial specification
and template yourself.
+Once, you gathered execution data, you can run
+```shell
+java ... org.apache.wayang.profiler.ga.GeneticOptimizerApp [configuration URL
[execution log]]
+```
+This app will try to find appropriate values for the question marks (`?`) in
the load profile estimator templates to fit the gathered execution data and
ready-made configuration entries for the load profile estimators.
+You can then copy them into your configuration.
+
+### WordCount
+
+The "Hello World!" of data processing systems is the wordcount.
+
+#### Java API
+```java
+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 WordcountJava {
+
+ public static void main(String[] args){
+
+ // Settings
+ String inputUrl = "file:/tmp.txt";
+
+ // Get a plan builder.
+ WayangContext wayangContext = new WayangContext(new Configuration())
+ .withPlugin(Java.basicPlugin())
+ .withPlugin(Spark.basicPlugin());
+ JavaPlanBuilder planBuilder = new JavaPlanBuilder(wayangContext)
+ .withJobName(String.format("WordCount (%s)", inputUrl))
+ .withUdfJarOf(WordcountJava.class);
+
+ // Start building the WayangPlan.
+ Collection<Tuple2<String, Integer>> wordcounts = planBuilder
+ // Read the text file.
+ .readTextFile(inputUrl).withName("Load file")
+
+ // Split each line by non-word characters.
+ .flatMap(line -> Arrays.asList(line.split("\\W+")))
+ .withSelectivity(10, 100, 0.9)
+ .withName("Split words")
+
+ // Filter empty tokens.
+ .filter(token -> !token.isEmpty())
+ .withSelectivity(0.99, 0.99, 0.99)
+ .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())
+ )
+ .withCardinalityEstimator(new DefaultCardinalityEstimator(0.9,
1, false, in -> Math.round(0.01 * in[0])))
+ .withName("Add counters")
+
+ // Execute the plan and collect the results.
+ .collect();
+
+ System.out.println(wordcounts);
+ }
+}
+```
+
+#### Scala API
+
+```scala
+import org.apache.wayang.api._
+import org.apache.wayang.core.api.{Configuration, WayangContext}
+import org.apache.wayang.java.Java
+import org.apache.wayang.spark.Spark
+
+object WordcountScala {
+ def main(args: Array[String]) {
+
+ // Settings
+ val inputUrl = "file:/tmp.txt"
+
+ // Get a plan builder.
+ val wayangContext = new WayangContext(new Configuration)
+ .withPlugin(Java.basicPlugin)
+ .withPlugin(Spark.basicPlugin)
+ val planBuilder = new PlanBuilder(wayangContext)
+ .withJobName(s"WordCount ($inputUrl)")
+ .withUdfJarsOf(this.getClass)
+
+ val wordcounts = planBuilder
+ // Read the text file.
+ .readTextFile(inputUrl).withName("Load file")
+
+ // Split each line by non-word characters.
+ .flatMap(_.split("\\W+"), selectivity = 10).withName("Split words")
+
+ // Filter empty tokens.
+ .filter(_.nonEmpty, selectivity = 0.99).withName("Filter empty words")
+
+ // Attach counter to each word.
+ .map(word => (word.toLowerCase, 1)).withName("To lower case, add
counter")
+
+ // Sum up counters for every word.
+ .reduceByKey(_._1, (c1, c2) => (c1._1, c1._2 + c2._2)).withName("Add
counters")
+ .withCardinalityEstimator((in: Long) => math.round(in * 0.01))
+
+ // Execute the plan and collect the results.
+ .collect()
+
+ println(wordcounts)
+ }
+}
+```
+
+### k-means
+
+Wayang is also capable of iterative processing, which is, e.g., very important
for machine learning algorithms, such as k-means.
+
+#### Scala API
+
+```scala
+import org.apache.wayang.api._
+import org.apache.wayang.core.api.{Configuration, WayangContext}
+import
org.apache.wayang.core.function.FunctionDescriptor.ExtendedSerializableFunction
+import org.apache.wayang.core.function.ExecutionContext
+import org.apache.wayang.core.optimizer.costs.LoadProfileEstimators
+import org.apache.wayang.java.Java
+import org.apache.wayang.spark.Spark
+
+import scala.util.Random
+import scala.collection.JavaConversions._
+
+object kmeans {
+ def main(args: Array[String]) {
+
+ // Settings
+ val inputUrl = "file:/kmeans.txt"
+ val k = 5
+ val iterations = 100
+ val configuration = new Configuration
+
+ // Get a plan builder.
+ val wayangContext = new WayangContext(new Configuration)
+ .withPlugin(Java.basicPlugin)
+ .withPlugin(Spark.basicPlugin)
+ val planBuilder = new PlanBuilder(wayangContext)
+ .withJobName(s"k-means ($inputUrl, k=$k, $iterations iterations)")
+ .withUdfJarsOf(this.getClass)
+
+ case class Point(x: Double, y: Double)
+ case class TaggedPoint(x: Double, y: Double, cluster: Int)
+ case class TaggedPointCounter(x: Double, y: Double, cluster: Int, count:
Long) {
+ def add_points(that: TaggedPointCounter) = TaggedPointCounter(this.x +
that.x, this.y + that.y, this.cluster, this.count + that.count)
+ def average = TaggedPointCounter(x / count, y / count, cluster, 0)
+ }
+
+ // Read and parse the input file(s).
+ val points = planBuilder
+ .readTextFile(inputUrl).withName("Read file")
+ .map { line =>
+ val fields = line.split(",")
+ Point(fields(0).toDouble, fields(1).toDouble)
+ }.withName("Create points")
+
+
+ // Create initial centroids.
+ val random = new Random
+ val initialCentroids = planBuilder
+ .loadCollection(for (i <- 1 to k) yield
TaggedPointCounter(random.nextGaussian(), random.nextGaussian(), i,
0)).withName("Load random centroids")
+
+ // Declare UDF to select centroid for each data point.
+ class SelectNearestCentroid extends ExtendedSerializableFunction[Point,
TaggedPointCounter] {
+
+ /** Keeps the broadcasted centroids. */
+ var centroids: Iterable[TaggedPointCounter] = _
+
+ override def open(executionCtx: ExecutionContext) = {
+ centroids = executionCtx.getBroadcast[TaggedPointCounter]("centroids")
+ }
+
+ override def apply(point: Point): TaggedPointCounter = {
+ var minDistance = Double.PositiveInfinity
+ var nearestCentroidId = -1
+ for (centroid <- centroids) {
+ val distance = Math.pow(Math.pow(point.x - centroid.x, 2) +
Math.pow(point.y - centroid.y, 2), 0.5)
+ if (distance < minDistance) {
+ minDistance = distance
+ nearestCentroidId = centroid.cluster
+ }
+ }
+ new TaggedPointCounter(point.x, point.y, nearestCentroidId, 1)
+ }
+ }
+
+ // Do the k-means loop.
+ val finalCentroids = initialCentroids.repeat(iterations, {
currentCentroids =>
+ points
+ .mapJava(new SelectNearestCentroid,
+ udfLoad = LoadProfileEstimators.createFromSpecification(
+ "my.udf.costfunction.key", configuration
+ ))
+ .withBroadcast(currentCentroids, "centroids").withName("Find nearest
centroid")
+ .reduceByKey(_.cluster, _.add_points(_)).withName("Add up points")
+ .withCardinalityEstimator(k)
+ .map(_.average).withName("Average points")
+ }).withName("Loop")
+
+ // Collect the results.
+ .collect()
+
+ println(finalCentroids)
+ }
+}
+```
+
+## License
+
+All files in this repository are licensed under the Apache Software License 2.0
+
+Copyright 2020 - 2021 The Apache Software Foundation.
+
+Licensed 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.
Added: dev/incubator/wayang/0.6.0/rc8/RELEASE_NOTES
==============================================================================
--- dev/incubator/wayang/0.6.0/rc8/RELEASE_NOTES (added)
+++ dev/incubator/wayang/0.6.0/rc8/RELEASE_NOTES Fri Nov 26 17:07:22 2021
@@ -0,0 +1,47 @@
+==============================================================
+Apache Wayang (incubating) 0.6.0
+==============================================================
+
+This is the first official release of Apache Wayang (incubating).
+
+This release supports the following frameworks:
+
+- Apache Flink v1.7.1
+- Apache Giraph v1.2.0-hadoop2
+- GraphChi v0.2.2 (only available with scala 11.x)
+- Java Streams (version depends on the java version)
+- JDBC-Template
+- Postgres v9.4.1208 (Implementation JDBC-Template)
+- Apache Spark v3.1.2 (scala 12.x) and v2.4.8 (scala 11.x)
+- SQLite3 v3.8.11.2 (implementation JDBC-Template)
+
+NOTE: depending on the scala version the list of the supported platforms
available
+could be different.
+
+
+New Features
+------------
+
+support M1 ARM architecture
+
+Incompatible changes
+--------------------
+
+- NONE -
+
+Miscellaneous changes
+---------------------
+
+WAYANG-3 Unification of logs
+WAYANG-[32, 33, 35, 38] License issues removed
+
+Known Issues
+------------
+
+WAYANG-23 Iteration Memory Issue
+
+Bug Fixes
+---------
+
+WAYANG-12 Issues on the compilation
+WAYANG-40 Different version of platform depending on the scala version
Added:
dev/incubator/wayang/0.6.0/rc8/apache-wayang-0.6.0-incubating-source-release.zip
==============================================================================
Binary file - no diff available.
Propchange:
dev/incubator/wayang/0.6.0/rc8/apache-wayang-0.6.0-incubating-source-release.zip
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
dev/incubator/wayang/0.6.0/rc8/apache-wayang-0.6.0-incubating-source-release.zip.asc
==============================================================================
---
dev/incubator/wayang/0.6.0/rc8/apache-wayang-0.6.0-incubating-source-release.zip.asc
(added)
+++
dev/incubator/wayang/0.6.0/rc8/apache-wayang-0.6.0-incubating-source-release.zip.asc
Fri Nov 26 17:07:22 2021
@@ -0,0 +1,16 @@
+-----BEGIN PGP SIGNATURE-----
+
+iQIzBAABCgAdFiEEqhSFtTMF8dlAn4a7T+7DRY0yMSIFAmGhDfEACgkQT+7DRY0y
+MSJL5g/+IQucb0lOlajbyAi0V6aXtfRq5V2BVLt3stFtTvyMrxRu8IYVAx4IAN1x
+TUrnMX8zEDlC4irgCmlYJwBOLcx6VBYLxvksJZy0cpwKg2GmY3f7xV+Jlprl5O0V
+EiF9IRhZ+j9ibRgRF8D+Ego4VRyJuOpXjlilORsbk0SxCZ6oCTD1hfquj+FcXUEx
+dHuYYFs2UPwH3xcIxAovDJ9SakUdw1K/CMBj+xoRcpRD63ECTkCz4RPbsXtg1eoo
+zAdM2burpP3lGm1hw1kfRf/V87t5SnIRfZIaOOhPmrNN6GlPPbIjhQNN5JwW1T6j
+WlKwPoUr6xtCNUUpGD91ZwDMmE2ift/gykCGs/O26NEhzEVX+PU4/DKkmfL1oDxx
+LGS5XOilKnxeHnKY3daI1pGUJUr6qNKQ4WcEI/8YoLsSh0DKmAxaygBJ83xj1xpS
+FUbShaZEzblkeD4uRLcnZHaZy0sZ5l3aApre5jiR8CfaREC42PEkmS1i5f1MfM+U
+yu1eQuJsNalk5Vt+bvLriBZCl40Tvcx9j/CP6Q0e2vmHXncP0bT0A+zjaCRiCf0V
+vfAVfklT4yMgQo38jRDaN1zi2P0dBnEPV4mtlHy1S5W610QbhPi12NCMcUViJ2R/
+Mw2j1S1TwuZtpyYY4X8El8+EHqj2g578m+vTMdiqm29lkDG8+oU=
+=ZYbU
+-----END PGP SIGNATURE-----
Added:
dev/incubator/wayang/0.6.0/rc8/apache-wayang-0.6.0-incubating-source-release.zip.sha512
==============================================================================
---
dev/incubator/wayang/0.6.0/rc8/apache-wayang-0.6.0-incubating-source-release.zip.sha512
(added)
+++
dev/incubator/wayang/0.6.0/rc8/apache-wayang-0.6.0-incubating-source-release.zip.sha512
Fri Nov 26 17:07:22 2021
@@ -0,0 +1 @@
+453d47c2a0c9f543af06f07787145c70268e972b0348ccf375703f10946a1f8ba5e3ee4ece9668136c3437ff4a27a225e19d00047dbfd2167fcfa7407586aa6e
\ No newline at end of file