Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit19b7c3a

Browse files
feat: Add InputBytes to extract job statistics (#2998)
* feat: Add InputBytes to extract job statistics* feat: Add InputBytes to extract job statistics* 🦉 Updates from OwlBot post-processorSeehttps://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md---------Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent6d14b27 commit19b7c3a

File tree

4 files changed

+35
-6
lines changed

4 files changed

+35
-6
lines changed

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ implementation 'com.google.cloud:google-cloud-bigquery'
6060
If you are using Gradle without BOM, add this to your dependencies:
6161

6262
```Groovy
63-
implementation 'com.google.cloud:google-cloud-bigquery:2.34.1'
63+
implementation 'com.google.cloud:google-cloud-bigquery:2.34.2'
6464
```
6565

6666
If you are using SBT, add this to your dependencies:
6767

6868
```Scala
69-
libraryDependencies+="com.google.cloud"%"google-cloud-bigquery"%"2.34.1"
69+
libraryDependencies+="com.google.cloud"%"google-cloud-bigquery"%"2.34.2"
7070
```
7171
<!-- {x-version-update-end}-->
7272

@@ -351,7 +351,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
351351
[kokoro-badge-link-5]:http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigquery/java11.html
352352
[stability-image]:https://img.shields.io/badge/stability-stable-green
353353
[maven-version-image]:https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigquery.svg
354-
[maven-version-link]:https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquery/2.34.1
354+
[maven-version-link]:https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquery/2.34.2
355355
[authentication]:https://github.com/googleapis/google-cloud-java#authentication
356356
[auth-scopes]:https://developers.google.com/identity/protocols/oauth2/scopes
357357
[predefined-iam-roles]:https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

‎google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobStatistics.java‎

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,21 @@ public static class ExtractStatistics extends JobStatistics {
101101

102102
privatefinalList<Long>destinationUriFileCounts;
103103

104+
privatefinalLonginputBytes;
105+
104106
staticfinalclassBuilderextendsJobStatistics.Builder<ExtractStatistics,Builder> {
105107

106108
privateList<Long>destinationUriFileCounts;
107109

110+
privateLonginputBytes;
111+
108112
privateBuilder() {}
109113

110114
privateBuilder(com.google.api.services.bigquery.model.JobStatisticsstatisticsPb) {
111115
super(statisticsPb);
112116
if (statisticsPb.getExtract() !=null) {
113117
this.destinationUriFileCounts =statisticsPb.getExtract().getDestinationUriFileCounts();
118+
this.inputBytes =statisticsPb.getExtract().getInputBytes();
114119
}
115120
}
116121

@@ -119,6 +124,11 @@ Builder setDestinationUriFileCounts(List<Long> destinationUriFileCounts) {
119124
returnself();
120125
}
121126

127+
BuildersetInputBytes(LonginputBytes) {
128+
this.inputBytes =inputBytes;
129+
returnself();
130+
}
131+
122132
@Override
123133
ExtractStatisticsbuild() {
124134
returnnewExtractStatistics(this);
@@ -128,6 +138,7 @@ ExtractStatistics build() {
128138
privateExtractStatistics(Builderbuilder) {
129139
super(builder);
130140
this.destinationUriFileCounts =builder.destinationUriFileCounts;
141+
this.inputBytes =builder.inputBytes;
131142
}
132143

133144
/**
@@ -139,6 +150,11 @@ public List<Long> getDestinationUriFileCounts() {
139150
returndestinationUriFileCounts;
140151
}
141152

153+
/** Returns number of user bytes extracted into the result. */
154+
publicLonggetInputBytes() {
155+
returninputBytes;
156+
}
157+
142158
@Override
143159
ToStringHelpertoStringHelper() {
144160
returnsuper.toStringHelper().add("destinationUriFileCounts",destinationUriFileCounts);
@@ -159,9 +175,10 @@ public final int hashCode() {
159175

160176
@Override
161177
com.google.api.services.bigquery.model.JobStatisticstoPb() {
162-
com.google.api.services.bigquery.model.JobStatisticsstatisticsPb =super.toPb();
163-
returnstatisticsPb.setExtract(
164-
newJobStatistics4().setDestinationUriFileCounts(destinationUriFileCounts));
178+
JobStatistics4extractStatisticsPb =newJobStatistics4();
179+
extractStatisticsPb.setDestinationUriFileCounts(destinationUriFileCounts);
180+
extractStatisticsPb.setInputBytes(inputBytes);
181+
returnsuper.toPb().setExtract(extractStatisticsPb);
165182
}
166183

167184
staticBuildernewBuilder() {

‎google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/JobStatisticsTest.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public class JobStatisticsTest {
9797
.setEndTime(END_TIME)
9898
.setStartTime(START_TIME)
9999
.setDestinationUriFileCounts(FILE_COUNT)
100+
.setInputBytes(INPUT_BYTES)
100101
.build();
101102
privatestaticfinalLoadStatisticsLOAD_STATISTICS =
102103
LoadStatistics.newBuilder()
@@ -249,6 +250,7 @@ public void testBuilder() {
249250
assertEquals(START_TIME,EXTRACT_STATISTICS.getStartTime());
250251
assertEquals(END_TIME,EXTRACT_STATISTICS.getEndTime());
251252
assertEquals(FILE_COUNT,EXTRACT_STATISTICS.getDestinationUriFileCounts());
253+
assertEquals(INPUT_BYTES,EXTRACT_STATISTICS.getInputBytes());
252254

253255
assertEquals(CREATION_TIME,LOAD_STATISTICS.getCreationTime());
254256
assertEquals(START_TIME,LOAD_STATISTICS.getStartTime());
@@ -385,6 +387,7 @@ private void compareExtractStatistics(ExtractStatistics expected, ExtractStatist
385387
assertEquals(expected,value);
386388
compareStatistics(expected,value);
387389
assertEquals(expected.getDestinationUriFileCounts(),value.getDestinationUriFileCounts());
390+
assertEquals(expected.getInputBytes(),value.getInputBytes());
388391
}
389392

390393
privatevoidcompareLoadStatistics(LoadStatisticsexpected,LoadStatisticsvalue) {

‎google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
importcom.google.cloud.bigquery.JobId;
8888
importcom.google.cloud.bigquery.JobInfo;
8989
importcom.google.cloud.bigquery.JobStatistics;
90+
importcom.google.cloud.bigquery.JobStatistics.ExtractStatistics;
9091
importcom.google.cloud.bigquery.JobStatistics.LoadStatistics;
9192
importcom.google.cloud.bigquery.JobStatistics.QueryStatistics;
9293
importcom.google.cloud.bigquery.JobStatistics.QueryStatistics.StatementType;
@@ -5304,6 +5305,8 @@ public void testExtractJob() throws InterruptedException, TimeoutException {
53045305
assertNull(remoteLoadJob.getStatus().getError());
53055306
LoadJobConfigurationloadJobConfiguration =remoteLoadJob.getConfiguration();
53065307
assertEquals(labels,loadJobConfiguration.getLabels());
5308+
LoadStatisticsloadStatistics =remoteLoadJob.getStatistics();
5309+
assertNotNull(loadStatistics);
53075310

53085311
ExtractJobConfigurationextractConfiguration =
53095312
ExtractJobConfiguration.newBuilder(destinationTable,"gs://" +BUCKET +"/" +EXTRACT_FILE)
@@ -5313,6 +5316,12 @@ public void testExtractJob() throws InterruptedException, TimeoutException {
53135316
remoteExtractJob =remoteExtractJob.waitFor();
53145317
assertNull(remoteExtractJob.getStatus().getError());
53155318

5319+
ExtractStatisticsextractStatistics =remoteExtractJob.getStatistics();
5320+
assertNotNull(extractStatistics);
5321+
assertEquals(1L,extractStatistics.getDestinationUriFileCounts().size());
5322+
assertEquals(
5323+
loadStatistics.getOutputBytes().longValue(),extractStatistics.getInputBytes().longValue());
5324+
53165325
StringextractedCsv =
53175326
newString(storage.readAllBytes(BUCKET,EXTRACT_FILE),StandardCharsets.UTF_8);
53185327
assertEquals(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp