Skip to content

Commit 70017c0

Browse files
nktaushanovsduskis
authored andcommitted
---
yaml --- r: 13969 b: refs/heads/autosynth-container c: 31971fb h: refs/heads/master i: 13967: ac4d1bc
1 parent 6cf5013 commit 70017c0

3 files changed

Lines changed: 19 additions & 7 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ refs/tags/v0.65.0: 10939381ffe0b8da32db4fe3087c86e3aa7f3e55
113113
refs/tags/v0.66.0: ed6a3f57cbdaa20339a1995f7d7d53b172a5b8ef
114114
refs/tags/v0.67.0: 30b56f02092efc6f3c3667650ea8b8825003e0b7
115115
refs/heads/autosynth-compute: 8e86445e504cea6f99b9fb237bfd7f0e5ef8b3ce
116-
refs/heads/autosynth-container: 9bf5b350fa4634c436e60dc6dffd525085410590
116+
refs/heads/autosynth-container: 31971fbd56a025bdb9c55ac226e2eaad6a7e7562
117117
refs/heads/autosynth-dataproc: bc74a8841bc1693d7945d991d15979df550b1fd1
118118
refs/heads/autosynth-monitoring: 120f508e0065f4ce39cf0e6a69a08138773f2cfb
119119
refs/heads/autosynth-pubsub: ed3340e32d13bb1a42ca4431cb1ad9bdaf550aa4

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ public static class StreamingBuffer implements Serializable {
5757
}
5858

5959
/** Returns a lower-bound estimate of the number of rows currently in the streaming buffer. */
60-
public long getEstimatedRows() {
60+
public Long getEstimatedRows() {
6161
return estimatedRows;
6262
}
6363

6464
/** Returns a lower-bound estimate of the number of bytes currently in the streaming buffer. */
65-
public long getEstimatedBytes() {
65+
public Long getEstimatedBytes() {
6666
return estimatedBytes;
6767
}
6868

@@ -95,10 +95,17 @@ public boolean equals(Object obj) {
9595
}
9696

9797
Streamingbuffer toPb() {
98-
return new Streamingbuffer()
99-
.setEstimatedBytes(BigInteger.valueOf(estimatedBytes))
100-
.setEstimatedRows(BigInteger.valueOf(estimatedRows))
101-
.setOldestEntryTime(BigInteger.valueOf(oldestEntryTime));
98+
Streamingbuffer buffer = new Streamingbuffer();
99+
if (estimatedBytes != null) {
100+
buffer.setEstimatedBytes(BigInteger.valueOf(estimatedBytes));
101+
}
102+
if (estimatedRows != null) {
103+
buffer.setEstimatedRows(BigInteger.valueOf(estimatedRows));
104+
}
105+
if (oldestEntryTime != null) {
106+
buffer.setOldestEntryTime(BigInteger.valueOf(oldestEntryTime));
107+
}
108+
return buffer;
102109
}
103110

104111
static StreamingBuffer fromPb(Streamingbuffer streamingBufferPb) {

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ public void testFromPbWithNullEstimatedRowsAndBytes() {
120120
TABLE_DEFINITION.toPb().setStreamingBuffer(new Streamingbuffer()));
121121
}
122122

123+
@Test
124+
public void testStreamingBufferWithNullFieldsToPb() {
125+
new StreamingBuffer(null, null, null).toPb();
126+
}
127+
123128
private void compareStandardTableDefinition(
124129
StandardTableDefinition expected, StandardTableDefinition value) {
125130
assertEquals(expected, value);

0 commit comments

Comments
 (0)