Adding util methods to assist in adding deletion support to Quick Start
This commit is contained in:
committed by
Bhavani Sudha Saktheeswaran
parent
9b2944a9a2
commit
87fdb769f0
@@ -170,6 +170,22 @@ public class QuickstartUtils {
|
|||||||
return updates;
|
return updates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates new Deletes, randomly distributed across the keys above. There can be duplicates within the returned
|
||||||
|
* list
|
||||||
|
*
|
||||||
|
* @param n Number of deletes (including dups)
|
||||||
|
* @return list of hoodie records to delete
|
||||||
|
*/
|
||||||
|
public List<HoodieKey> generateDeletes(Integer n) throws IOException {
|
||||||
|
List<HoodieKey> deletes = new ArrayList<>();
|
||||||
|
for (int i = 0; i < n; i++) {
|
||||||
|
HoodieKey key = existingKeys.get(rand.nextInt(numExistingKeys));
|
||||||
|
deletes.add(key);
|
||||||
|
}
|
||||||
|
return deletes;
|
||||||
|
}
|
||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
existingKeys.clear();
|
existingKeys.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user