Skip to content

Commit cd22513

Browse files
nktaushanovsduskis
authored andcommitted
---
yaml --- r: 12969 b: refs/heads/autosynth-scheduler c: 31971fb h: refs/heads/master i: 12967: d6df3b4
1 parent 34b896a commit cd22513

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
@@ -138,7 +138,7 @@ refs/heads/autosynth-kms: dcc6e15d68759010c8735cc868135bd7e6c1cc5f
138138
refs/heads/autosynth-language: 8972866b016473559702424205ce5569de47b34d
139139
refs/heads/autosynth-os-login: daa910328b954bbe87068f684a3088ed910f1ddf
140140
refs/heads/autosynth-redis: 4c68cb0fbc599124e717ab3f24bd8a8a5d085ca9
141-
refs/heads/autosynth-scheduler: 9bf5b350fa4634c436e60dc6dffd525085410590
141+
refs/heads/autosynth-scheduler: 31971fbd56a025bdb9c55ac226e2eaad6a7e7562
142142
refs/heads/autosynth-securitycenter: 80dc94847b954c97a641519177c98dc8e9e9fbe1
143143
refs/heads/autosynth-spanner: 1804eb46dd34a05b47163758d376a7fac49188f1
144144
refs/heads/autosynth-speech: 631df42a628621fe42eb4974c9eb725b2fe8e473

branches/autosynth-scheduler/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-scheduler/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)