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
BatchStage.sort() #2469
Conversation
…y-sorting # Conflicts: # hazelcast-jet-core/src/main/java/com/hazelcast/jet/core/Edge.java # hazelcast-jet-core/src/main/java/com/hazelcast/jet/impl/execution/init/EdgeDef.java
Can one of the admins verify this patch? |
5 similar comments
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
add @SInCE cleanup
headItem = headObject; | ||
} | ||
if (headItem == null) { | ||
return NO_PROGRESS; |
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.
You may already have made progress by consuming some items in previous while
loop iterations.
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.
Done
This also needs adding to /site/docs/api/stateful-transforms.md |
} | ||
|
||
/** | ||
* Returns the comparator defined on this edge. |
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
* @since 4.3 | ||
*/ | ||
@Nonnull | ||
BatchStage<T> sort(@Nonnull ComparatorEx<T> comparator); |
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.
should be ? super T
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 comment
The reason will be displayed to describe this comment to others. Learn more.
should use T
here instead of V
import java.util.TreeSet; | ||
|
||
public class SortPrepareP<V> extends AbstractProcessor { | ||
private final SortedSet<V> set; |
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.
I don't think using SortedSet is correct here. It will skip duplicates. PriorityQueue
would be more correct.
hazelcast-jet-core/src/main/java/com/hazelcast/jet/impl/processor/SortP.java
Show resolved
Hide resolved
hazelcast-jet-core/src/main/java/com/hazelcast/jet/core/processor/Processors.java
Show resolved
Hide resolved
hazelcast-jet-core/src/main/java/com/hazelcast/jet/pipeline/BatchStage.java
Show resolved
Hide resolved
@MohamedMandouh if possible, you should do |
Just |
verify |
Can one of the admins verify this patch? |
5 similar comments
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Introduces sorting feature for batch use cases of hazelcast jet.
Usage:
BatchStage.sort()
for sorting based on natural ordering of items.BatchStage.sort(ComparatorEx<V> comparator)
for sorting based on user-defined comparator.Breaking change: this changes the
Edge
andEdgeDef
serialization format, breaking the backwards compatibility of a suspended job if it resumes on a newer Jet version.Checklist
@Nonnull/@Nullable
annotations@since
tags in Javadoc