Skip to content

Commit 1e7e5c4

Browse files
nktaushanovsduskis
authored andcommitted
---
yaml --- r: 15775 b: refs/heads/autosynth-dialogflow c: 31971fb h: refs/heads/master i: 15773: a37731d 15771: b1cd5a3 15767: f3ba951 15759: 30544d8 15743: 5023631
1 parent 9e468e0 commit 1e7e5c4

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
@@ -130,7 +130,7 @@ refs/heads/autosynth-bigtable: 2fbcb15847e0e89e79d6dc07420e28d7dfcea894
130130
refs/heads/autosynth-bigtable-admin: 6379a2bc712f2736c83de0e009b4d26da4fa82ca
131131
refs/heads/autosynth-containeranalysis: 039ca5b8db725c76c16a965ff26b2774322b8ef8
132132
refs/heads/autosynth-datastore: 9acd400b484d6691a080c9152a331d88d24fefc1
133-
refs/heads/autosynth-dialogflow: 9bf5b350fa4634c436e60dc6dffd525085410590
133+
refs/heads/autosynth-dialogflow: 31971fbd56a025bdb9c55ac226e2eaad6a7e7562
134134
refs/heads/autosynth-errorreporting: 3d0566d6bebcc187f148bbed463b5a8e75b1edf6
135135
refs/heads/autosynth-firestore: 92b27fbc8855c9902168695abb0a8f1f433b750b
136136
refs/heads/autosynth-iot: 9d732be07d99843d8cb53d34ec0837328a807fce

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