Jackeyzhe commented on code in PR #28478:
URL: https://github.com/apache/flink/pull/28478#discussion_r3439875108
##########
flink-core-api/src/main/java/org/apache/flink/configuration/MemorySize.java:
##########
@@ -56,6 +57,8 @@ public class MemorySize implements java.io.Serializable,
Comparable<MemorySize>
private static final List<MemoryUnit> ORDERED_UNITS =
Arrays.asList(BYTES, KILO_BYTES, MEGA_BYTES, GIGA_BYTES,
TERA_BYTES);
+ private static final Pattern MEMORY_SIZE_FORMAT =
Pattern.compile("\\d+\\s*[a-zA-Z]*");
Review Comment:
Thanks for the suggestion. I updated the patch to validate the unit part as
well, and then adjusted it to build the accepted unit pattern from
`MemoryUnit.values()` instead of duplicating the unit aliases in the regex.
I also strengthened the invalid-unit test with `MemorySize.parseBytes("16
gjah")`.
Verified with:
`./mvnw -pl flink-core-api -Dtest=MemorySizeTest test`
--
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]