Initial try#2922
Closed
vipul1409 wants to merge 2 commits into
Closed
Conversation
added 2 commits
November 30, 2016 21:42
vipul1409
commented
Dec 2, 2016
| // split up the lines in pairs (2-tuples) containing: (word,1) | ||
| //text.flatMap(new Tokenizer()).keyBy(0).sum(1); | ||
| text.flatMap(new MultiThreadedFlatMapFunction<String, Tuple2<String, Integer>>(new Tokenizer(),10)). | ||
| returns(new TypeHint<Tuple2<String, Integer>>(){}).keyBy(0).sum(1); |
Author
There was a problem hiding this comment.
Can I avoid return call somehow?
vipul1409
commented
Dec 2, 2016
| futures.add(flatMapExecutors.submit(new Callable<ArrayList<OUT>>() { | ||
| @Override | ||
| public ArrayList<OUT> call() throws Exception { | ||
| ArrayList<OUT> result = new ArrayList<OUT>(); |
Author
There was a problem hiding this comment.
As each call may take significant time we need to ensure that all the results objects of active threads can stay in memory.
vipul1409
commented
Dec 2, 2016
| @Override | ||
| public ArrayList<OUT> call() throws Exception { | ||
| ArrayList<OUT> result = new ArrayList<OUT>(); | ||
| Collector<OUT> collector = new ListCollector<OUT>(result); |
Author
There was a problem hiding this comment.
Any suggestions on which collector would be a good choice over here. I am not aware of all the options. Is there any document available for different collectors.
Contributor
|
Please include a description of the PR in the Title (including the relevant JIRA) and main post; we can't review it like this. |
Author
|
Closing pull request as this is not needed. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MultiThreadedFlatMapFunction provides an interface to execute execute flatmap using a set of threads. We can specify number of threads in the Constructor.
Usage flatMap(new MultiThreadedFlatMapFunction<String, Tuple2<String, Integer>>(new Tokenizer(),10)). Refer https://github.com/apache/flink/pull/2922/files#diff-27952c7e65576c8436355775051d8abb for usage example.
Please let me know if more details are needed.