Skip to content

Commit e3003f4

Browse files
authored
feat: Add missing storage related fields to Table, TableInfo and StandardTableDefinition (#2673)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [x] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/java-bigquery/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) Fixes #2672 ☕️
1 parent 08061f1 commit e3003f4

File tree

7 files changed

+426
-0
lines changed

7 files changed

+426
-0
lines changed

google-cloud-bigquery/clirr-ignored-differences.xml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,41 @@
5454
<className>com/google/cloud/bigquery/StandardTableDefinition*</className>
5555
<method>*TableConstraints(*)</method>
5656
</difference>
57+
<difference>
58+
<differenceType>7013</differenceType>
59+
<className>com/google/cloud/bigquery/StandardTableDefinition*</className>
60+
<method>*NumActiveLogicalBytes(*)</method>
61+
</difference>
62+
<difference>
63+
<differenceType>7013</differenceType>
64+
<className>com/google/cloud/bigquery/StandardTableDefinition*</className>
65+
<method>*NumActivePhysicalBytes(*)</method>
66+
</difference>
67+
<difference>
68+
<differenceType>7013</differenceType>
69+
<className>com/google/cloud/bigquery/StandardTableDefinition*</className>
70+
<method>*NumLongTermLogicalBytes(*)</method>
71+
</difference>
72+
<difference>
73+
<differenceType>7013</differenceType>
74+
<className>com/google/cloud/bigquery/StandardTableDefinition*</className>
75+
<method>*NumLongTermPhysicalBytes(*)</method>
76+
</difference>
77+
<difference>
78+
<differenceType>7013</differenceType>
79+
<className>com/google/cloud/bigquery/StandardTableDefinition*</className>
80+
<method>*NumTimeTravelPhysicalBytes(*)</method>
81+
</difference>
82+
<difference>
83+
<differenceType>7013</differenceType>
84+
<className>com/google/cloud/bigquery/StandardTableDefinition*</className>
85+
<method>*NumTotalLogicalBytes(*)</method>
86+
</difference>
87+
<difference>
88+
<differenceType>7013</differenceType>
89+
<className>com/google/cloud/bigquery/StandardTableDefinition*</className>
90+
<method>*NumTotalPhysicalBytes(*)</method>
91+
</difference>
5792
<difference>
5893
<differenceType>7013</differenceType>
5994
<className>com/google/cloud/bigquery/TableInfo*</className>

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/StandardTableDefinition.java

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,20 @@ public abstract static class Builder
132132

133133
public abstract Builder setNumLongTermBytes(Long numLongTermBytes);
134134

135+
public abstract Builder setNumTimeTravelPhysicalBytes(Long numTimeTravelPhysicalBytes);
136+
137+
public abstract Builder setNumTotalLogicalBytes(Long numTotalLogicalBytes);
138+
139+
public abstract Builder setNumActiveLogicalBytes(Long numActiveLogicalBytes);
140+
141+
public abstract Builder setNumLongTermLogicalBytes(Long numLongTermLogicalBytes);
142+
143+
public abstract Builder setNumTotalPhysicalBytes(Long numTotalPhysicalBytes);
144+
145+
public abstract Builder setNumActivePhysicalBytes(Long numActivePhysicalBytes);
146+
147+
public abstract Builder setNumLongTermPhysicalBytes(Long numLongTermPhysicalBytes);
148+
135149
public abstract Builder setNumRows(Long numRows);
136150

137151
public abstract Builder setLocation(String location);
@@ -180,6 +194,62 @@ public abstract static class Builder
180194
@Nullable
181195
public abstract Long getNumLongTermBytes();
182196

197+
/**
198+
* Returns the number of time travel physical bytes.
199+
*
200+
* @see <a href="https://cloud.google.com/bigquery/pricing#storage">Storage Pricing</a>
201+
*/
202+
@Nullable
203+
public abstract Long getNumTimeTravelPhysicalBytes();
204+
205+
/**
206+
* Returns the number of total logical bytes.
207+
*
208+
* @see <a href="https://cloud.google.com/bigquery/pricing#storage">Storage Pricing</a>
209+
*/
210+
@Nullable
211+
public abstract Long getNumTotalLogicalBytes();
212+
213+
/**
214+
* Returns the number of active logical bytes.
215+
*
216+
* @see <a href="https://cloud.google.com/bigquery/pricing#storage">Storage Pricing</a>
217+
*/
218+
@Nullable
219+
public abstract Long getNumActiveLogicalBytes();
220+
221+
/**
222+
* Returns the number of long term logical bytes.
223+
*
224+
* @see <a href="https://cloud.google.com/bigquery/pricing#storage">Storage Pricing</a>
225+
*/
226+
@Nullable
227+
public abstract Long getNumLongTermLogicalBytes();
228+
229+
/**
230+
* Returns the number of total physical bytes.
231+
*
232+
* @see <a href="https://cloud.google.com/bigquery/pricing#storage">Storage Pricing</a>
233+
*/
234+
@Nullable
235+
public abstract Long getNumTotalPhysicalBytes();
236+
237+
/**
238+
* Returns the number of active physical bytes.
239+
*
240+
* @see <a href="https://cloud.google.com/bigquery/pricing#storage">Storage Pricing</a>
241+
*/
242+
@Nullable
243+
public abstract Long getNumActivePhysicalBytes();
244+
245+
/**
246+
* Returns the number of long term physical bytes.
247+
*
248+
* @see <a href="https://cloud.google.com/bigquery/pricing#storage">Storage Pricing</a>
249+
*/
250+
@Nullable
251+
public abstract Long getNumLongTermPhysicalBytes();
252+
183253
/** Returns the number of rows in this table, excluding any data in the streaming buffer. */
184254
@Nullable
185255
public abstract Long getNumRows();
@@ -255,6 +325,13 @@ Table toPb() {
255325
}
256326
tablePb.setNumBytes(getNumBytes());
257327
tablePb.setNumLongTermBytes(getNumLongTermBytes());
328+
tablePb.setNumTimeTravelPhysicalBytes(getNumTimeTravelPhysicalBytes());
329+
tablePb.setNumTotalLogicalBytes(getNumTotalLogicalBytes());
330+
tablePb.setNumActiveLogicalBytes(getNumActiveLogicalBytes());
331+
tablePb.setNumLongTermLogicalBytes(getNumLongTermLogicalBytes());
332+
tablePb.setNumTotalPhysicalBytes(getNumTotalPhysicalBytes());
333+
tablePb.setNumActivePhysicalBytes(getNumActivePhysicalBytes());
334+
tablePb.setNumLongTermPhysicalBytes(getNumLongTermPhysicalBytes());
258335
tablePb.setLocation(getLocation());
259336
if (getStreamingBuffer() != null) {
260337
tablePb.setStreamingBuffer(getStreamingBuffer().toPb());
@@ -308,6 +385,27 @@ static StandardTableDefinition fromPb(Table tablePb) {
308385
if (tablePb.getNumLongTermBytes() != null) {
309386
builder.setNumLongTermBytes(tablePb.getNumLongTermBytes());
310387
}
388+
if (tablePb.getNumTimeTravelPhysicalBytes() != null) {
389+
builder.setNumTimeTravelPhysicalBytes(tablePb.getNumTimeTravelPhysicalBytes());
390+
}
391+
if (tablePb.getNumTotalLogicalBytes() != null) {
392+
builder.setNumTotalLogicalBytes(tablePb.getNumTotalLogicalBytes());
393+
}
394+
if (tablePb.getNumActiveLogicalBytes() != null) {
395+
builder.setNumActiveLogicalBytes(tablePb.getNumActiveLogicalBytes());
396+
}
397+
if (tablePb.getNumLongTermLogicalBytes() != null) {
398+
builder.setNumLongTermLogicalBytes(tablePb.getNumLongTermLogicalBytes());
399+
}
400+
if (tablePb.getNumTotalPhysicalBytes() != null) {
401+
builder.setNumTotalPhysicalBytes(tablePb.getNumTotalPhysicalBytes());
402+
}
403+
if (tablePb.getNumActivePhysicalBytes() != null) {
404+
builder.setNumActivePhysicalBytes(tablePb.getNumActivePhysicalBytes());
405+
}
406+
if (tablePb.getNumLongTermPhysicalBytes() != null) {
407+
builder.setNumLongTermPhysicalBytes(tablePb.getNumLongTermPhysicalBytes());
408+
}
311409
if (tablePb.getTableConstraints() != null) {
312410
builder.setTableConstraints(TableConstraints.fromPb(tablePb.getTableConstraints()));
313411
}

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Table.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,48 @@ Builder setNumLongTermBytes(Long numLongTermBytes) {
114114
return this;
115115
}
116116

117+
@Override
118+
Builder setNumTimeTravelPhysicalBytes(Long numTimeTravelPhysicalBytes) {
119+
infoBuilder.setNumTimeTravelPhysicalBytes(numTimeTravelPhysicalBytes);
120+
return this;
121+
}
122+
123+
@Override
124+
Builder setNumTotalLogicalBytes(Long numTotalLogicalBytes) {
125+
infoBuilder.setNumTotalLogicalBytes(numTotalLogicalBytes);
126+
return this;
127+
}
128+
129+
@Override
130+
Builder setNumActiveLogicalBytes(Long numActiveLogicalBytes) {
131+
infoBuilder.setNumActiveLogicalBytes(numActiveLogicalBytes);
132+
return this;
133+
}
134+
135+
@Override
136+
Builder setNumLongTermLogicalBytes(Long numLongTermLogicalBytes) {
137+
infoBuilder.setNumLongTermLogicalBytes(numLongTermLogicalBytes);
138+
return this;
139+
}
140+
141+
@Override
142+
Builder setNumTotalPhysicalBytes(Long numTotalPhysicalBytes) {
143+
infoBuilder.setNumTotalPhysicalBytes(numTotalPhysicalBytes);
144+
return this;
145+
}
146+
147+
@Override
148+
Builder setNumActivePhysicalBytes(Long numActivePhysicalBytes) {
149+
infoBuilder.setNumActivePhysicalBytes(numActivePhysicalBytes);
150+
return this;
151+
}
152+
153+
@Override
154+
Builder setNumLongTermPhysicalBytes(Long numLongTermPhysicalBytes) {
155+
infoBuilder.setNumLongTermPhysicalBytes(numLongTermPhysicalBytes);
156+
return this;
157+
}
158+
117159
@Override
118160
Builder setNumRows(BigInteger numRows) {
119161
infoBuilder.setNumRows(numRows);

0 commit comments

Comments
 (0)