xianjingfeng commented on code in PR #2405:
URL: https://github.com/apache/uniffle/pull/2405#discussion_r2077054594
##########
client-spark/common/src/main/java/org/apache/uniffle/shuffle/manager/RssShuffleManagerBase.java:
##########
@@ -1538,6 +1546,48 @@ public boolean isValidTask(String taskId) {
return !failedTaskIds.contains(taskId);
}
+ protected <K> String encode(Ordering<K> obj) {
+ try {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(obj);
+ oos.close();
+ return "#" + Base64.getEncoder().encodeToString(baos.toByteArray());
+ } catch (Exception e) {
+ throw new RssException(e);
+ }
+ }
+
+ protected <K, V, C> MergeContext buildMergeContext(ShuffleDependency<K, V,
C> dependency) {
+ if (remoteMergeEnable) {
+ MergeContext mergeContext =
+ MergeContext.newBuilder()
+ .setKeyClass(dependency.keyClassName())
+ .setValueClass(
+ dependency.mapSideCombine()
+ ? dependency.combinerClassName().get()
+ : dependency.valueClassName())
+ .setComparatorClass(
+ dependency
+ .keyOrdering()
+ .map(
+ new AbstractFunction1<Ordering<K>, String>() {
+ @Override
+ public String apply(Ordering<K> o) {
+ return encode(o);
+ }
+ })
+ .get())
Review Comment:
if dependency.keyOrdering().isDefined() == false, an exception will be
thrown here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]