Skip to content

Commit 7b16577

Browse files
committed
chore: Address PR comments
1 parent aca72f0 commit 7b16577

File tree

1 file changed

+6
-9
lines changed
  • google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/it/util

1 file changed

+6
-9
lines changed

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/it/util/Helper.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import com.google.cloud.bigquery.storage.v1.ReadRowsResponse;
3131
import com.google.cloud.bigquery.storage.v1.ReadSession;
3232
import com.google.common.base.Preconditions;
33-
import com.google.protobuf.Timestamp;
33+
import com.google.protobuf.util.Timestamps;
3434
import java.io.ByteArrayInputStream;
3535
import java.io.IOException;
3636
import java.io.InputStream;
@@ -68,8 +68,8 @@ public static ServiceAccountCredentials loadCredentials(String credentialFile) {
6868
}
6969

7070
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;
7373

7474
public void onSuccess(AppendRowsResponse response) {
7575
synchronized (lock) {
@@ -117,15 +117,12 @@ public static void processRowsAtSnapshot(
117117
ReadSession.newBuilder().setTable(table).setDataFormat(DataFormat.AVRO).build());
118118

119119
if (snapshotInMillis != null) {
120-
Timestamp snapshotTimestamp =
121-
Timestamp.newBuilder()
122-
.setSeconds(snapshotInMillis / 1_000)
123-
.setNanos((int) ((snapshotInMillis % 1000) * 1000000))
124-
.build();
125120
createSessionRequestBuilder
126121
.getReadSessionBuilder()
127122
.setTableModifiers(
128-
ReadSession.TableModifiers.newBuilder().setSnapshotTime(snapshotTimestamp).build());
123+
ReadSession.TableModifiers.newBuilder()
124+
.setSnapshotTime(Timestamps.fromMicros(snapshotInMillis))
125+
.build());
129126
}
130127

131128
if (filter != null && !filter.isEmpty()) {

0 commit comments

Comments
 (0)