Skip to content

Commit

Permalink
Add a method to generate generic record in test data gen
Browse files Browse the repository at this point in the history
  • Loading branch information
guanziyue committed Mar 20, 2022
1 parent ab3f9ad commit 1877192
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -860,12 +860,14 @@ public boolean deleteExistingKeyIfPresent(HoodieKey key) {
return false;
}

public GenericRecord generateGenericRecord() {
return generateGenericRecord(genPseudoRandomUUID(rand).toString(), "0",
genPseudoRandomUUID(rand).toString(), genPseudoRandomUUID(rand).toString(), rand.nextLong());
}

public List<GenericRecord> generateGenericRecords(int numRecords) {
List<GenericRecord> list = new ArrayList<>();
IntStream.range(0, numRecords).forEach(i -> {
list.add(generateGenericRecord(genPseudoRandomUUID(rand).toString(), "0",
genPseudoRandomUUID(rand).toString(), genPseudoRandomUUID(rand).toString(), rand.nextLong()));
});
IntStream.range(0, numRecords).forEach(i -> list.add(generateGenericRecord()));
return list;
}

Expand Down

0 comments on commit 1877192

Please sign in to comment.