Skip to content

Commit dc9cd36

Browse files
nktaushanovsduskis
authored andcommitted
---
yaml --- r: 15149 b: refs/heads/autosynth-bigquerystorage c: 31971fb h: refs/heads/master i: 15147: 1bac7a2
1 parent 35b25e0 commit dc9cd36

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
@@ -125,7 +125,7 @@ refs/tags/v0.69.0: 78f67a29e8b9c46ba01de566a2eae0fd1c03edea
125125
refs/heads/autosynth-asset: cd8251de8c40e239ad24dcf9ed93ea2708a3eed5
126126
refs/heads/autosynth-automl: cced2f56bbef0499609073edbca6253e1df5e535
127127
refs/heads/autosynth-bigquerydatatransfer: a6667617707608b1dbfb02d59c22b5152f208da7
128-
refs/heads/autosynth-bigquerystorage: 9bf5b350fa4634c436e60dc6dffd525085410590
128+
refs/heads/autosynth-bigquerystorage: 31971fbd56a025bdb9c55ac226e2eaad6a7e7562
129129
refs/heads/autosynth-bigtable: fa0d1de9e264d7ecac8a3abc3de7a8364cfaf427
130130
refs/heads/autosynth-bigtable-admin: 6379a2bc712f2736c83de0e009b4d26da4fa82ca
131131
refs/heads/autosynth-containeranalysis: 781fdb430a60f9a6491f116e31e4e10118157bdb

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