Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Clean up after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
nwangtw committed Nov 8, 2018
1 parent 3598935 commit b9e889b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import org.apache.heron.api.bolt.IBasicBolt;

/**
* The interface for streamlet basic operators. It is used to support existing user bolts
* extended from IBasicBolt only. It shouldn't be used to create streamlet operators.
* The interface for streamlet operators. It can be used to create
* operators based on existing Bolts (subclasses of IBasicBolt).
*/
public interface IStreamletBasicOperator<R, T> extends IStreamletOperator<R, T>, IBasicBolt {
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
package org.apache.heron.streamlet;

/**
<<<<<<< 3598935c369f2c0de4832c6c1a3e4db2219edcd4
* The base interface for all Streamlet operator interfaces.
=======
* The interface for custom operators: it can be used to create
* operators based on existing Bolts (subclasses of IRichBolt).
>>>>>>> Clean up after rebase
*/
public interface IStreamletOperator<R, T> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* to implement more advanced features.
* 2. Use it in Streamlet
* ....
* .perform(new MyOperator())
* .applyOperator(new MyOperator())
* ....
*/
public abstract class CustomOperator<R, T> extends StreamletOperator<R, T> {
Expand All @@ -68,6 +68,7 @@ public abstract class CustomOperator<R, T> extends StreamletOperator<R, T> {
* @param context This object can be used to get information about this task's place within the topology, including the task id and component id of this task, input and output information, etc.
* @param collector The collector is used to emit tuples from this bolt. Tuples can be emitted at any time, including the prepare and cleanup methods. The collector is thread-safe and should be saved as an instance variable of this bolt object.
*/
@Override
public void prepare(Map<String, Object> heronConf,
TopologyContext context,
OutputCollector collector) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import org.apache.heron.common.basics.ByteAmount;
import org.apache.heron.resource.TestBasicBolt;
import org.apache.heron.resource.TestBolt;
import org.apache.heron.resource.TestWindowBolt;
import org.apache.heron.resource.TestCustomOperator;
import org.apache.heron.resource.TestWindowBolt;
import org.apache.heron.streamlet.Config;
import org.apache.heron.streamlet.Context;
import org.apache.heron.streamlet.IStreamletBasicOperator;
Expand Down Expand Up @@ -265,23 +265,6 @@ public void testCustomStreamlet() throws Exception {
assertEquals(supplierStreamlet.getChildren().get(0), streamlet);
}

private class MyBoltOperator extends TestBolt implements IStreamletOperator<Double, Double> {
}

@Test
@SuppressWarnings("unchecked")
public void testCustomStreamletFromBolt() throws Exception {
Streamlet<Double> baseStreamlet = StreamletImpl.createSupplierStreamlet(() -> Math.random());
Streamlet<Double> streamlet = baseStreamlet.setNumPartitions(20).
applyOperator(new MyBoltOperator());
assertTrue(streamlet instanceof CustomStreamlet);
CustomStreamlet<Double, Double> mStreamlet = (CustomStreamlet<Double, Double>) streamlet;
assertEquals(20, mStreamlet.getNumPartitions());
SupplierStreamlet<Double> supplierStreamlet = (SupplierStreamlet<Double>) baseStreamlet;
assertEquals(supplierStreamlet.getChildren().size(), 1);
assertEquals(supplierStreamlet.getChildren().get(0), streamlet);
}

@Test
@SuppressWarnings("unchecked")
public void testSimpleBuild() throws Exception {
Expand Down

0 comments on commit b9e889b

Please sign in to comment.