|
30 | 30 | import com.google.cloud.bigquery.storage.v1.ReadRowsResponse; |
31 | 31 | import com.google.cloud.bigquery.storage.v1.ReadSession; |
32 | 32 | import com.google.common.base.Preconditions; |
33 | | -import com.google.protobuf.Timestamp; |
| 33 | +import com.google.protobuf.util.Timestamps; |
34 | 34 | import java.io.ByteArrayInputStream; |
35 | 35 | import java.io.IOException; |
36 | 36 | import java.io.InputStream; |
@@ -68,8 +68,8 @@ public static ServiceAccountCredentials loadCredentials(String credentialFile) { |
68 | 68 | } |
69 | 69 |
|
70 | 70 | public static class AppendCompleteCallback implements ApiFutureCallback<AppendRowsResponse> { |
71 | | - private static final Object lock = new Object(); |
72 | | - private static int batchCount = 0; |
| 71 | + private final Object lock = new Object(); |
| 72 | + private int batchCount = 0; |
73 | 73 |
|
74 | 74 | public void onSuccess(AppendRowsResponse response) { |
75 | 75 | synchronized (lock) { |
@@ -117,15 +117,12 @@ public static void processRowsAtSnapshot( |
117 | 117 | ReadSession.newBuilder().setTable(table).setDataFormat(DataFormat.AVRO).build()); |
118 | 118 |
|
119 | 119 | if (snapshotInMillis != null) { |
120 | | - Timestamp snapshotTimestamp = |
121 | | - Timestamp.newBuilder() |
122 | | - .setSeconds(snapshotInMillis / 1_000) |
123 | | - .setNanos((int) ((snapshotInMillis % 1000) * 1000000)) |
124 | | - .build(); |
125 | 120 | createSessionRequestBuilder |
126 | 121 | .getReadSessionBuilder() |
127 | 122 | .setTableModifiers( |
128 | | - ReadSession.TableModifiers.newBuilder().setSnapshotTime(snapshotTimestamp).build()); |
| 123 | + ReadSession.TableModifiers.newBuilder() |
| 124 | + .setSnapshotTime(Timestamps.fromMicros(snapshotInMillis)) |
| 125 | + .build()); |
129 | 126 | } |
130 | 127 |
|
131 | 128 | if (filter != null && !filter.isEmpty()) { |
|
0 commit comments