Skip to content

Commit d7c554f

Browse files
committed
use fetch
1 parent dc438cb commit d7c554f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bigtable/beam/keyviz-art/src/main/java/keyviz/FSReadData2.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static class ReadFromTableFn extends DoFn<Long, Void> {
6363
protected Datastore datastore;
6464
private KeyFactory keyFactory;
6565
// private final String kind = "BillyDF500reversed1mswithP";
66-
private final String kind = "BillyDFrw1s500rows";
66+
private final String kind = "BillyDFrw1s500rowsWithFetch";
6767

6868
private static final int RANDOM_ID_BOUND = 500;
6969
Random rand = new Random();
@@ -150,14 +150,16 @@ public void processElement(@Element Long count, OutputReceiver<Void> out) {
150150
long seconds = timestampDiff / 1000;
151151
int timeOffsetIndex = Math.toIntExact(seconds / KEY_VIZ_WINDOW_SECONDS);
152152

153+
List<com.google.cloud.datastore.Key> keysToFetch = new ArrayList<>();
153154
for (int i = 0; i < maxInput; i++) {
154155
if (timeOffsetIndex % 2 == 0) {
155156
String paddedRowkey = String.format(numberFormat, i);
156157
String reversedRowkey = new StringBuilder(paddedRowkey).reverse().toString();
157-
datastore.get(keyFactory.newKey(reversedRowkey));
158+
keysToFetch.add(keyFactory.newKey(reversedRowkey));
158159
c++;
159160
}
160161
}
162+
datastore.fetch();
161163
System.out.println(c + " entities fetched");
162164

163165
// String kind = "Billy10ms1krs";

0 commit comments

Comments
 (0)