Skip to content

Commit ce54e37

Browse files
author
Praful Makani
committed
update methods and resolved test case
1 parent 7a4a350 commit ce54e37

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Table.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.google.common.collect.ImmutableList;
2525
import java.io.IOException;
2626
import java.io.ObjectInputStream;
27+
import java.math.BigInteger;
2728
import java.util.List;
2829
import java.util.Map;
2930
import java.util.Objects;
@@ -101,6 +102,18 @@ Builder setLastModifiedTime(Long lastModifiedTime) {
101102
return this;
102103
}
103104

105+
@Override
106+
Builder setNumBytes(Long numBytes) {
107+
infoBuilder.setNumBytes(numBytes);
108+
return this;
109+
}
110+
111+
@Override
112+
Builder setNumRows(BigInteger numRows) {
113+
infoBuilder.setNumRows(numRows);
114+
return this;
115+
}
116+
104117
@Override
105118
Builder setSelfLink(String selfLink) {
106119
infoBuilder.setSelfLink(selfLink);

google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableInfo.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ public abstract static class Builder {
9494

9595
abstract Builder setLastModifiedTime(Long lastModifiedTime);
9696

97+
abstract Builder setNumBytes(Long numBytes);
98+
99+
abstract Builder setNumRows(BigInteger numRows);
100+
97101
abstract Builder setSelfLink(String selfLink);
98102

99103
/** Sets the table identity. */
@@ -225,6 +229,18 @@ Builder setLastModifiedTime(Long lastModifiedTime) {
225229
return this;
226230
}
227231

232+
@Override
233+
Builder setNumBytes(Long numBytes) {
234+
this.numBytes = numBytes;
235+
return this;
236+
}
237+
238+
@Override
239+
Builder setNumRows(BigInteger numRows) {
240+
this.numRows = numRows;
241+
return this;
242+
}
243+
228244
@Override
229245
Builder setSelfLink(String selfLink) {
230246
this.selfLink = selfLink;
@@ -431,8 +447,6 @@ Table toPb() {
431447
if (lastModifiedTime != null) {
432448
tablePb.setLastModifiedTime(BigInteger.valueOf(lastModifiedTime));
433449
}
434-
tablePb.setNumBytes(numBytes);
435-
tablePb.setNumRows(numRows);
436450
tablePb.setCreationTime(creationTime);
437451
tablePb.setDescription(description);
438452
tablePb.setEtag(etag);

google-cloud-clients/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/TableInfoTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import static org.junit.Assert.assertNull;
2121

2222
import com.google.common.collect.ImmutableList;
23+
import java.math.BigInteger;
2324
import java.util.Collections;
2425
import java.util.List;
2526
import org.junit.Test;
@@ -93,6 +94,8 @@ public class TableInfoTest {
9394
.setFriendlyName(FRIENDLY_NAME)
9495
.setGeneratedId(GENERATED_ID)
9596
.setLastModifiedTime(LAST_MODIFIED_TIME)
97+
.setNumBytes(NUM_BYTES)
98+
.setNumRows(BigInteger.valueOf(NUM_ROWS))
9699
.setSelfLink(SELF_LINK)
97100
.setLabels(Collections.singletonMap("a", "b"))
98101
.build();
@@ -244,6 +247,8 @@ private void compareTableInfo(TableInfo expected, TableInfo value) {
244247
assertEquals(expected.getFriendlyName(), value.getFriendlyName());
245248
assertEquals(expected.getGeneratedId(), value.getGeneratedId());
246249
assertEquals(expected.getLastModifiedTime(), value.getLastModifiedTime());
250+
assertEquals(expected.getNumBytes(), value.getNumBytes());
251+
assertEquals(expected.getNumRows(), value.getNumRows());
247252
assertEquals(expected.getSelfLink(), value.getSelfLink());
248253
assertEquals(expected.getLabels(), value.getLabels());
249254
assertEquals(expected.hashCode(), value.hashCode());

0 commit comments

Comments
 (0)