New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BatchStage.sort() #2469
Merged
mtopolnik
merged 39 commits into
hazelcast:master
from
MohamedMandouh:in-memory-sorting
Sep 16, 2020
Merged
BatchStage.sort() #2469
Changes from 10 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
cfcd5fe
add in-memory sort
MohamedMandouh 25cfa0f
add in-memory sort
MohamedMandouh 7478050
Merge remote-tracking branch 'origin/in-memory-sorting' into in-memor…
MohamedMandouh 26e76f7
remove SerializableComparator
MohamedMandouh 139910d
replace TreeMap with TreeSet
MohamedMandouh b7e2393
replace ComparatorEx by Comparator in SortPrepareP
MohamedMandouh 8d4013f
add @NonNull/@Nullable
MohamedMandouh a1e488d
add BatchStage.sort()
MohamedMandouh 1176d43
fix returning NO_PROGRESS whenever a queue returns null
MohamedMandouh 4c8897d
pass checkstyle
MohamedMandouh 9f4a0b1
apply requested changes
MohamedMandouh 9b9cba5
Add @Nonnull
532e4ab
Remove the requirement for Comparator<Object>
1c8a39d
Improve Javadoc
a7b9ea5
Assert monotonic order in CIES
18a7d4f
Simplify draining logic in CIES
ca64396
Remove numActiveQueues
8b884ea
Merge nested ifs
a6ad9b2
Upgraded deps in NOTICE
9499597
Improve Javadoc of Processors.sortPrepareP
193663d
Improve generic type treatment
c02162c
Simplify SortPrepareP
89d5109
Rename SortPrepareP -> SortP
bf4907a
Fix generics
4f30b5c
Merge branch 'master' into in-memory-sorting
2a3be96
Work around JDK 8 compiler bug
8cb3897
Fix two bugs
f1bbf30
Add BatchStageTest.sort()
d629a5c
add ProcessorsTest.sort
MohamedMandouh a23a817
add missing Override
MohamedMandouh eb6751d
add sample usage, param and return annotaitions
MohamedMandouh 5f59a0d
add "only available for batch" in javadoc
MohamedMandouh 0e38170
introduce BatchStage.partialSort
MohamedMandouh c0d102b
cleanup
MohamedMandouh 029432b
Revert "cleanup"
MohamedMandouh a045a23
Revert "introduce BatchStage.partialSort"
MohamedMandouh b3d124d
Improve Javadoc
85a31da
Improved Edge doc
befdc1d
Add jet-start.sh docs
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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
58 changes: 58 additions & 0 deletions
58
...lcast-jet-core/src/main/java/com/hazelcast/jet/impl/pipeline/transform/SortTransform.java
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,58 @@ | ||
/* | ||
* Copyright (c) 2008-2020, Hazelcast, Inc. All Rights Reserved. | ||
* | ||
* 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. | ||
*/ | ||
|
||
package com.hazelcast.jet.impl.pipeline.transform; | ||
|
||
import com.hazelcast.function.ComparatorEx; | ||
import com.hazelcast.jet.core.ProcessorMetaSupplier; | ||
import com.hazelcast.jet.core.ProcessorSupplier; | ||
import com.hazelcast.jet.core.Vertex; | ||
import com.hazelcast.jet.core.processor.Processors; | ||
import com.hazelcast.jet.impl.pipeline.Planner; | ||
import com.hazelcast.jet.impl.pipeline.Planner.PlannerVertex; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
||
import static com.hazelcast.function.FunctionEx.identity; | ||
import static com.hazelcast.jet.core.Edge.between; | ||
import static com.hazelcast.jet.core.processor.Processors.sortPrepareP; | ||
|
||
|
||
public class SortTransform<V> extends AbstractTransform { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should use |
||
|
||
private static final String FIRST_STAGE_VERTEX_NAME_SUFFIX = "-prepare"; | ||
private final ComparatorEx<V> comparator; | ||
|
||
public SortTransform(@Nonnull Transform upstream, @Nullable ComparatorEx<V> comparator) { | ||
super("sort", upstream); | ||
if (comparator == null) { | ||
this.comparator = (ComparatorEx<V>) (o1, o2) -> ((Comparable<V>) o1).compareTo(o2); | ||
} else { | ||
this.comparator = comparator; | ||
} | ||
} | ||
|
||
@Override | ||
public void addToDag(Planner p) { | ||
Vertex v1 = p.dag.newVertex(name() + FIRST_STAGE_VERTEX_NAME_SUFFIX, sortPrepareP(comparator)); | ||
PlannerVertex pv2 = p.addVertex(this, name(), 1, ProcessorMetaSupplier | ||
.forceTotalParallelismOne(ProcessorSupplier.of(Processors.mapP(identity())), name())); | ||
p.addEdges(this, v1); | ||
p.dag.edge(between(v1, pv2.v).distributed().allToOne(name().hashCode()) | ||
.monotonicOrder((ComparatorEx<Object>) comparator)); | ||
} | ||
} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could add a reference back to monoticOrder here