Thesharing commented on a change in pull request #16071:
URL: https://github.com/apache/flink/pull/16071#discussion_r645264141
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/EdgeManagerBuildUtil.java
##########
@@ -133,7 +133,7 @@ private static void connectPointwise(
float factor = ((float) targetCount) / sourceCount;
int start = (int) (Math.ceil(partitionNum * factor));
- int end = (int) (Math.ceil((partitionNum + 1) * factor));
+ int end = Math.min(targetCount, (int) (Math.ceil((partitionNum
+ 1) * factor)));
Review comment:
> I think both computations can be done a bit cheaper if I am not
mistaken:
>
> ```
> int start = (partitionNum * targetCount + sourceCount - 1) / sourceCount;
> int end = ((partitionNum + 1) * targetCount + sourceCount - 1) /
sourceCount;
> ```
>
> That way we would not rely on inaccurate floating point calculations.
Thank you for this awesome idea, Till! I've already modified the PR with it
and tested several cases.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]