xushiyan commented on a change in pull request #2079:
URL: https://github.com/apache/hudi/pull/2079#discussion_r487433796
##########
File path:
hudi-common/src/test/java/org/apache/hudi/common/testutils/HoodieTestTable.java
##########
@@ -66,6 +73,30 @@ public static HoodieTestTable of(HoodieTableMetaClient
metaClient) {
return new HoodieTestTable(metaClient.getBasePath(),
metaClient.getRawFs(), metaClient);
}
+ public static String makeNewCommitTime(int sequence) {
+ return String.format("%09d", sequence);
+ }
+
+ public static String makeNewCommitTime() {
+ return makeNewCommitTime(Instant.now());
+ }
+
+ public static String makeNewCommitTime(Instant time) {
+ return COMMIT_FORMATTER.format(time);
+ }
+
+ public static List<String> makeNewCommitTimes(int num) {
+ return makeNewCommitTimes(num, 1);
+ }
+
+ public static List<String> makeNewCommitTimes(int num, int
firstOffsetSeconds) {
+ final Instant now = Instant.now();
+ return IntStream.range(0, num)
+ .mapToObj(i ->
+ makeNewCommitTime(now.plus(i == 0 ? firstOffsetSeconds :
firstOffsetSeconds + i, SECONDS)))
+ .collect(Collectors.toList());
+ }
Review comment:
to replace `HoodieTestUtils#monotonicIncreasingCommitTimestamps(int
numTimestamps, int startSecsDelta)`
##########
File path:
hudi-client/src/test/java/org/apache/hudi/testutils/HoodieClientTestHarness.java
##########
@@ -66,17 +65,12 @@
protected transient HoodieTestDataGenerator dataGen = null;
protected transient ExecutorService executorService;
protected transient HoodieTableMetaClient metaClient;
- private static AtomicInteger instantGen = new AtomicInteger(1);
protected transient HoodieWriteClient writeClient;
protected transient HoodieReadClient readClient;
protected transient HoodieTableFileSystemView tableView;
protected final SparkTaskContextSupplier supplier = new
SparkTaskContextSupplier();
- public String getNextInstant() {
- return String.format("%09d", instantGen.getAndIncrement());
- }
-
Review comment:
Remove this implementation due to lack of reusability; use
`HoodieTestTable#makeNewCommitTime(int sequence)` instead
----------------------------------------------------------------
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]