zhuzhurk commented on a change in pull request #10079: [FLINK-14594] Fix
matching logics of ResourceSpec/ResourceProfile/Resource considering double
values
URL: https://github.com/apache/flink/pull/10079#discussion_r346827603
##########
File path:
flink-core/src/main/java/org/apache/flink/api/common/resources/Resource.java
##########
@@ -33,71 +34,34 @@
private static final long serialVersionUID = 1L;
- /**
- * Enum defining how resources are aggregated.
- */
- public enum ResourceAggregateType {
- /**
- * Denotes keeping the sum of the values with same name when
merging two resource specs for operator chaining.
- */
- AGGREGATE_TYPE_SUM,
-
- /**
- * Denotes keeping the max of the values with same name when
merging two resource specs for operator chaining.
- */
- AGGREGATE_TYPE_MAX
- }
-
private final String name;
- private final double value;
+ private final BigDecimal value;
- private final ResourceAggregateType resourceAggregateType;
+ protected Resource(String name, double value) {
+ this(name, BigDecimal.valueOf(value));
+ }
- protected Resource(String name, double value, ResourceAggregateType
type) {
+ protected Resource(String name, BigDecimal value) {
Review comment:
Good catch! Sure we need this check to ensure the resource value is no less
than 0 (0 CPUResource is used in table currently so we need to allow it).
----------------------------------------------------------------
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]
With regards,
Apache Git Services