forked from nathanmarz/storm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:nathanmarz/storm into logback3
Conflicts: project.clj
- Loading branch information
Showing
11 changed files
with
125 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package storm.trident.operation; | ||
|
||
import java.util.Map; | ||
|
||
public abstract class BaseMultiReducer<T> implements MultiReducer<T> { | ||
|
||
@Override | ||
public void prepare(Map conf, TridentMultiReducerContext context) { | ||
} | ||
|
||
|
||
@Override | ||
public void cleanup() { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package storm.trident.testing; | ||
|
||
import backtype.storm.tuple.Values; | ||
import storm.trident.operation.BaseAggregator; | ||
import storm.trident.operation.TridentCollector; | ||
import storm.trident.tuple.TridentTuple; | ||
|
||
|
||
public class CountAsAggregator extends BaseAggregator<CountAsAggregator.State> { | ||
|
||
static class State { | ||
long count = 0; | ||
} | ||
|
||
@Override | ||
public State init(Object batchId, TridentCollector collector) { | ||
return new State(); | ||
} | ||
|
||
@Override | ||
public void aggregate(State state, TridentTuple tuple, TridentCollector collector) { | ||
state.count++; | ||
} | ||
|
||
@Override | ||
public void complete(State state, TridentCollector collector) { | ||
collector.emit(new Values(state.count)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package storm.trident.testing; | ||
|
||
import backtype.storm.tuple.Values; | ||
import storm.trident.operation.BaseFunction; | ||
import storm.trident.operation.TridentCollector; | ||
import storm.trident.tuple.TridentTuple; | ||
|
||
public class StringLength extends BaseFunction { | ||
|
||
@Override | ||
public void execute(TridentTuple tuple, TridentCollector collector) { | ||
collector.emit(new Values(tuple.getString(0).length())); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters