Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
zkaoudi committed Feb 12, 2024
1 parent 9b004f2 commit 1088690
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/guide/add-an-operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,24 @@ This guide shows the *3 steps* that developers need to follow if they want to ad
We use the Map operator as an example.

## Step 1: Add a Wayang operator
Wayang operators are located under the ```wayang-basic``` in the ```org.apache.wayang.basic.operators``` package. <br>
An operator needs to extend from one of the following abstract classes: ```UnaryToUnaryOperator```, ```BinaryToUnaryOperator```, ```UnarySource```, ```UnarySink```.<br>
Wayang operators are located under the ```wayang-basic``` in the ```org.apache.wayang.basic.operators``` package. <br/>
An operator needs to extend from one of the following abstract classes: ```UnaryToUnaryOperator```, ```BinaryToUnaryOperator```, ```UnarySource```, ```UnarySink```.<br/>
For a unary to unary operator, see for example [here](https://github.com/apache/incubator-wayang/blob/main/wayang-commons/wayang-basic/src/main/java/org/apache/wayang/basic/operators/MapOperator.java).

For enhanced performance in Wayang, consider adding a cardinality estimator by overriding the ```createCardinalityEstimator()``` function as [here](https://github.com/apache/incubator-wayang/blob/main/wayang-commons/wayang-basic/src/main/java/org/apache/wayang/basic/operators/MapOperator.java#L112C43-L112C70).

## Step 2: Add the (platform-specific) execution operators
Execution operators are located under the corresponding module of ```wayang-platforms```. For instance, Java execution operators are located in the ```org.apache.wayang.java.operators``` package of the ```wayang-java``` module.<br>
An execution operator needs to extend from its corresponding Wayang operator and implement the corresponding platform operator interface.<br>
Execution operators are located under the corresponding module of ```wayang-platforms```. For instance, Java execution operators are located in the ```org.apache.wayang.java.operators``` package of the ```wayang-java``` module.<br/>
An execution operator needs to extend from its corresponding Wayang operator and implement the corresponding platform operator interface.<br/>
For the above ```MapOperator```, the following is the corresponding [```JavaMapOperator```](https://github.com/apache/incubator-wayang/blob/main/wayang-platforms/wayang-java/src/main/java/org/apache/wayang/java/operators/JavaMapOperator.java).

For enhanced performance in Wayang, consider adding a load function as well:<br>
For enhanced performance in Wayang, consider adding a load function as well:<br/>
For this you need to overwrite the ```getLoadProfileEstimatorConfigurationKey()``` function and provide the right key that will then be read from a properties file.
For the JavaMapOperator it's: wayang.java.map.load. Then add in the corresponding properties file (e.g., [this](https://github.com/apache/incubator-wayang/blob/main/wayang-platforms/wayang-java/src/main/resources/wayang-java-defaults.properties) is for the java executor) the template which is the mathematical formula that represents the cost of this operator and an instantiation of it. See [here](https://github.com/apache/incubator-wayang/blob/main/wayang-platforms/wayang-java/src/main/resources/wayang-java-defaults.properties#L25) for the example of the map operator.

## Step 3: Add mappings
Create mappings from the Wayang operator to the platform-specific execution operators. <br>
The mappings are located in the corresponding execution module in the ```org.apache.wayang.java.operators``` package.<br>
Create mappings from the Wayang operator to the platform-specific execution operators. <br/>
The mappings are located in the corresponding execution module in the ```org.apache.wayang.java.operators``` package.<br/>
For the above ```MapOperator``` and ```JavaMapOperator```, see [here](https://github.com/apache/incubator-wayang/blob/main/wayang-platforms/wayang-java/src/main/java/org/apache/wayang/java/mapping/MapMapping.java).

After that you need to declare this mapping in Wayang in the corresponding [```Mappings```](https://github.com/apache/incubator-wayang/blob/main/wayang-platforms/wayang-java/src/main/java/org/apache/wayang/java/mapping/Mappings.java#L37) class.
Expand Down

0 comments on commit 1088690

Please sign in to comment.