Skip to content

Commit 25987f5

Browse files
ajaaymchingor13
authored andcommitted
---
yaml --- r: 11679 b: refs/heads/autosynth-pubsub c: de19e9f h: refs/heads/master i: 11677: 71de427 11675: 50a3202 11671: c0275a7 11663: d74bfb6 11647: fb83105
1 parent 65411cf commit 25987f5

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ refs/heads/autosynth-compute: fa508ebab5b6a1db14949441c8de868cefbcf1a6
116116
refs/heads/autosynth-container: d0346e84b1f26e3dc10444450a998f357a43bcef
117117
refs/heads/autosynth-dataproc: c0f21dd811166848a60f810565a5614bb9c7f47e
118118
refs/heads/autosynth-monitoring: 28bf7ca67c0aab4815884e5d6253aaa8aa3baa1c
119-
refs/heads/autosynth-pubsub: dc0a1ae5c4d401dc11b9f74ebd70381e38437ed8
119+
refs/heads/autosynth-pubsub: de19e9fd1f071bd7688832ec6bb7d0886c1ca2e6
120120
refs/heads/autosynth-video-intelligence: 06fb1841ae847f4ef79a62ba995efbabc213edf8
121121
refs/heads/autosynth-vision: 6bece1ee6c1c41d5822c72bf0d6a82484166b402
122122
refs/heads/spanner: 54a5e197bfe0a004e13c190427f46c3413ab572d

branches/autosynth-pubsub/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/StandardTableDefinition.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ public abstract class StandardTableDefinition extends TableDefinition {
4646
public static class StreamingBuffer implements Serializable {
4747

4848
private static final long serialVersionUID = 822027055549277843L;
49-
private final long estimatedRows;
50-
private final long estimatedBytes;
49+
private final Long estimatedRows;
50+
private final Long estimatedBytes;
5151
private final Long oldestEntryTime;
5252

53-
StreamingBuffer(long estimatedRows, long estimatedBytes, Long oldestEntryTime) {
53+
StreamingBuffer(Long estimatedRows, Long estimatedBytes, Long oldestEntryTime) {
5454
this.estimatedRows = estimatedRows;
5555
this.estimatedBytes = estimatedBytes;
5656
this.oldestEntryTime = oldestEntryTime;
@@ -113,8 +113,13 @@ static StreamingBuffer fromPb(Streamingbuffer streamingBufferPb) {
113113
if (streamingBufferPb.getOldestEntryTime() != null) {
114114
oldestEntryTime = streamingBufferPb.getOldestEntryTime().longValue();
115115
}
116-
return new StreamingBuffer(streamingBufferPb.getEstimatedRows().longValue(),
117-
streamingBufferPb.getEstimatedBytes().longValue(),
116+
return new StreamingBuffer(
117+
streamingBufferPb.getEstimatedRows() != null
118+
? streamingBufferPb.getEstimatedRows().longValue()
119+
: null,
120+
streamingBufferPb.getEstimatedBytes() != null
121+
? streamingBufferPb.getEstimatedBytes().longValue()
122+
: null,
118123
oldestEntryTime);
119124
}
120125
}

branches/autosynth-pubsub/google-cloud-clients/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/StandardTableDefinitionTest.java

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

23+
import com.google.api.services.bigquery.model.Streamingbuffer;
2324
import com.google.cloud.bigquery.StandardTableDefinition.StreamingBuffer;
2425

2526
import com.google.common.collect.ImmutableList;
@@ -117,6 +118,12 @@ public void testToAndFromPb() {
117118
TableDefinition.<StandardTableDefinition>fromPb(definition.toPb()));
118119
}
119120

121+
@Test
122+
public void testFromPbWithNullEstimatedRowsAndBytes() {
123+
StandardTableDefinition.fromPb(
124+
TABLE_DEFINITION.toPb().setStreamingBuffer(new Streamingbuffer()));
125+
}
126+
120127
private void compareStandardTableDefinition(StandardTableDefinition expected,
121128
StandardTableDefinition value) {
122129
assertEquals(expected, value);

0 commit comments

Comments
 (0)