Skip to content

Commit 0227414

Browse files
nktaushanovsduskis
authored andcommitted
---
yaml --- r: 12889 b: refs/heads/autosynth-bigtable c: 31971fb h: refs/heads/master i: 12887: 40a173c
1 parent c7958d2 commit 0227414

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
@@ -126,7 +126,7 @@ refs/heads/autosynth-asset: af3772eb76acbfc401f7c3f9310f09f2b0e17602
126126
refs/heads/autosynth-automl: d4315b3596bac160e3439432c54435f44b09953e
127127
refs/heads/autosynth-bigquerydatatransfer: 2a9f3938237f85a8919602d74011326580ff387f
128128
refs/heads/autosynth-bigquerystorage: 99aee05df348f39d98b6fb23c292006f1d2a6c28
129-
refs/heads/autosynth-bigtable: 9bf5b350fa4634c436e60dc6dffd525085410590
129+
refs/heads/autosynth-bigtable: 31971fbd56a025bdb9c55ac226e2eaad6a7e7562
130130
refs/heads/autosynth-bigtable-admin: 6379a2bc712f2736c83de0e009b4d26da4fa82ca
131131
refs/heads/autosynth-containeranalysis: 781fdb430a60f9a6491f116e31e4e10118157bdb
132132
refs/heads/autosynth-datastore: af1fb76aa3eee02fe6f31f8fa1c72a4f048d149b

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