tillrohrmann commented on a change in pull request #16071:
URL: https://github.com/apache/flink/pull/16071#discussion_r644772586
##########
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;
```
##########
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.
--
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]