xintongsong commented on a change in pull request #15815:
URL: https://github.com/apache/flink/pull/15815#discussion_r627889619
##########
File path:
flink-kubernetes/src/test/java/org/apache/flink/kubernetes/KubernetesResourceManagerDriverTest.java
##########
@@ -362,7 +362,12 @@ protected void validateRequestedResources(
.getMebiBytes())));
assertThat(
resourceRequirements.getRequests().get(Constants.RESOURCE_NAME_CPU).getAmount(),
-
is(String.valueOf(taskExecutorProcessSpec.getCpuCores().getValue())));
+ is(
+ String.valueOf(
+ taskExecutorProcessSpec
+ .getCpuCores()
+ .getValue()
+ .doubleValue())));
Review comment:
I think this is an indicator that this PR changes `Resource` in a way
that `Resource#getValue#toString` now may contain trailing zeros, which is
probably undesired. E.g., this may affect log readabilities.
We can use `BigDecimal#stripTrailingZeros` to make `Resource` avoid trailing
zeros.
##########
File path:
flink-core/src/main/java/org/apache/flink/api/common/resources/Resource.java
##########
@@ -45,11 +45,13 @@ protected Resource(String name, double value) {
protected Resource(String name, BigDecimal value) {
checkNotNull(value);
+ final BigDecimal valueRoundDown = value.setScale(8, RoundingMode.DOWN);
Review comment:
Maybe introduce a constant `MAX_VALUE_SCALE`.
--
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]