diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index f930d4846f..a9ab6bf94b 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -14,4 +14,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest digest: sha256:bc2bf47c7370f1b1a8a46b0c104ce7e43644ac58902c9de265fe1f253fcc2506 -# created: 2023-10-31T13:44:21.909247346Z diff --git a/.github/workflows/auto-release.yaml b/.github/workflows/auto-release.yaml index 92c69857f6..b27e937b45 100644 --- a/.github/workflows/auto-release.yaml +++ b/.github/workflows/auto-release.yaml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest if: contains(github.head_ref, 'release-please') steps: - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 with: github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} debug: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c4b28a2b0..940d1c5a5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # Changelog +## [2.35.0](https://github.com/googleapis/java-bigquery/compare/v2.34.2...v2.35.0) (2023-12-01) + + +### Features + +* Add InputBytes to extract job statistics ([#2998](https://github.com/googleapis/java-bigquery/issues/2998)) ([19b7c3a](https://github.com/googleapis/java-bigquery/commit/19b7c3ad842a566d4e3e93e48625e0281504de80)) +* Add Routine DataGovernanceType ([#3006](https://github.com/googleapis/java-bigquery/issues/3006)) ([ecb567b](https://github.com/googleapis/java-bigquery/commit/ecb567b75849cd0665ac4ab315a5af3bdf934f48)) + + +### Bug Fixes + +* Update TableInsertRows.java ([#2999](https://github.com/googleapis/java-bigquery/issues/2999)) ([ff4a086](https://github.com/googleapis/java-bigquery/commit/ff4a086f0aa3c0401b62489ea8a0b9e2fd6cb3fe)) + + +### Dependencies + +* Update actions/github-script action to v7 ([#3001](https://github.com/googleapis/java-bigquery/issues/3001)) ([d1bdeab](https://github.com/googleapis/java-bigquery/commit/d1bdeab242ea2e6374d1b6d0bbd9eadf638cbcb2)) +* Update actions/setup-java action to v4 ([#3018](https://github.com/googleapis/java-bigquery/issues/3018)) ([14ed571](https://github.com/googleapis/java-bigquery/commit/14ed571365f600b188b7d6716e2549c5b81868ad)) +* Update arrow.version to v14 ([#3023](https://github.com/googleapis/java-bigquery/issues/3023)) ([759fd64](https://github.com/googleapis/java-bigquery/commit/759fd64f73a437e4b9847a807b5b716069b4d20e)) +* Update dependency com.google.apis:google-api-services-bigquery to v2-rev20231111-2.0.0 ([#3020](https://github.com/googleapis/java-bigquery/issues/3020)) ([ef48002](https://github.com/googleapis/java-bigquery/commit/ef480029c9e1958c1b6a6f2241b110fb3cfe036d)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.20.0 ([#3019](https://github.com/googleapis/java-bigquery/issues/3019)) ([0293edb](https://github.com/googleapis/java-bigquery/commit/0293edb74e02f44803faacbce400df20da53f66c)) + ## [2.34.2](https://github.com/googleapis/java-bigquery/compare/v2.34.1...v2.34.2) (2023-11-07) diff --git a/README.md b/README.md index 686622a082..576fec2eba 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ If you are using Maven without the BOM, add this to your dependencies: com.google.cloud google-cloud-bigquery - 2.34.1 + 2.34.2 ``` @@ -53,20 +53,20 @@ If you are using Maven without the BOM, add this to your dependencies: If you are using Gradle 5.x or later, add this to your dependencies: ```Groovy -implementation platform('com.google.cloud:libraries-bom:26.26.0') +implementation platform('com.google.cloud:libraries-bom:26.27.0') implementation 'com.google.cloud:google-cloud-bigquery' ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-bigquery:2.34.1' +implementation 'com.google.cloud:google-cloud-bigquery:2.34.2' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.34.1" +libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.34.2" ``` @@ -351,7 +351,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigquery/java11.html [stability-image]: https://img.shields.io/badge/stability-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigquery.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquery/2.34.1 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquery/2.34.2 [authentication]: https://github.com/googleapis/google-cloud-java#authentication [auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes [predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles diff --git a/benchmark/pom.xml b/benchmark/pom.xml index eb6fcb814d..5be7ca2119 100644 --- a/benchmark/pom.xml +++ b/benchmark/pom.xml @@ -6,7 +6,7 @@ google-cloud-bigquery-parent com.google.cloud - 2.34.2 + 2.35.0 diff --git a/google-cloud-bigquery/clirr-ignored-differences.xml b/google-cloud-bigquery/clirr-ignored-differences.xml index c22579a795..7513b53240 100644 --- a/google-cloud-bigquery/clirr-ignored-differences.xml +++ b/google-cloud-bigquery/clirr-ignored-differences.xml @@ -19,6 +19,11 @@ com/google/cloud/bigquery/ExternalTableDefinition* *ReferenceFileSchemaUri(*) + + 7013 + com/google/cloud/bigquery/RoutineInfo* + *DataGovernanceType(*) + 7013 com/google/cloud/bigquery/RoutineInfo* diff --git a/google-cloud-bigquery/pom.xml b/google-cloud-bigquery/pom.xml index e0e6a8fb06..1806a4e4ed 100644 --- a/google-cloud-bigquery/pom.xml +++ b/google-cloud-bigquery/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-bigquery - 2.34.2 + 2.35.0 jar BigQuery https://github.com/googleapis/java-bigquery @@ -11,7 +11,7 @@ com.google.cloud google-cloud-bigquery-parent - 2.34.2 + 2.35.0 google-cloud-bigquery @@ -187,7 +187,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.4.0 + 3.5.0 add-source diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobStatistics.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobStatistics.java index 59c48615fd..1cbf22fa79 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobStatistics.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobStatistics.java @@ -101,16 +101,21 @@ public static class ExtractStatistics extends JobStatistics { private final List destinationUriFileCounts; + private final Long inputBytes; + static final class Builder extends JobStatistics.Builder { private List destinationUriFileCounts; + private Long inputBytes; + private Builder() {} private Builder(com.google.api.services.bigquery.model.JobStatistics statisticsPb) { super(statisticsPb); if (statisticsPb.getExtract() != null) { this.destinationUriFileCounts = statisticsPb.getExtract().getDestinationUriFileCounts(); + this.inputBytes = statisticsPb.getExtract().getInputBytes(); } } @@ -119,6 +124,11 @@ Builder setDestinationUriFileCounts(List destinationUriFileCounts) { return self(); } + Builder setInputBytes(Long inputBytes) { + this.inputBytes = inputBytes; + return self(); + } + @Override ExtractStatistics build() { return new ExtractStatistics(this); @@ -128,6 +138,7 @@ ExtractStatistics build() { private ExtractStatistics(Builder builder) { super(builder); this.destinationUriFileCounts = builder.destinationUriFileCounts; + this.inputBytes = builder.inputBytes; } /** @@ -139,6 +150,11 @@ public List getDestinationUriFileCounts() { return destinationUriFileCounts; } + /** Returns number of user bytes extracted into the result. */ + public Long getInputBytes() { + return inputBytes; + } + @Override ToStringHelper toStringHelper() { return super.toStringHelper().add("destinationUriFileCounts", destinationUriFileCounts); @@ -159,9 +175,10 @@ public final int hashCode() { @Override com.google.api.services.bigquery.model.JobStatistics toPb() { - com.google.api.services.bigquery.model.JobStatistics statisticsPb = super.toPb(); - return statisticsPb.setExtract( - new JobStatistics4().setDestinationUriFileCounts(destinationUriFileCounts)); + JobStatistics4 extractStatisticsPb = new JobStatistics4(); + extractStatisticsPb.setDestinationUriFileCounts(destinationUriFileCounts); + extractStatisticsPb.setInputBytes(inputBytes); + return super.toPb().setExtract(extractStatisticsPb); } static Builder newBuilder() { diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Routine.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Routine.java index d2d6ec6837..5d99ccfbdc 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Routine.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Routine.java @@ -135,6 +135,12 @@ public Builder setRemoteFunctionOptions(RemoteFunctionOptions remoteFunctionOpti return this; } + @Override + public Builder setDataGovernanceType(String dataGovernanceType) { + infoBuilder.setDataGovernanceType(dataGovernanceType); + return this; + } + @Override public Routine build() { return new Routine(bigquery, infoBuilder); diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/RoutineInfo.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/RoutineInfo.java index 3001d2fb97..7cea99f93f 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/RoutineInfo.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/RoutineInfo.java @@ -72,6 +72,8 @@ public Routine apply(RoutineInfo routineInfo) { private final String body; private final RemoteFunctionOptions remoteFunctionOptions; + private final String dataGovernanceType; + public abstract static class Builder { abstract Builder setRoutineId(RoutineId id); @@ -157,6 +159,13 @@ public abstract static class Builder { */ public abstract Builder setRemoteFunctionOptions(RemoteFunctionOptions remoteFunctionOptions); + /** + * Sets the data governance type for the Builder (e.g. DATA_MASKING). + * + *

See https://cloud.google.com/bigquery/docs/reference/rest/v2/routines + */ + public abstract Builder setDataGovernanceType(String dataGovernanceType); + /** Creates a {@code RoutineInfo} object. */ public abstract RoutineInfo build(); } @@ -177,6 +186,8 @@ static class BuilderImpl extends Builder { private String body; private RemoteFunctionOptions remoteFunctionOptions; + private String dataGovernanceType; + BuilderImpl() {} BuilderImpl(RoutineInfo routineInfo) { @@ -194,6 +205,7 @@ static class BuilderImpl extends Builder { this.importedLibrariesList = routineInfo.importedLibrariesList; this.body = routineInfo.body; this.remoteFunctionOptions = routineInfo.remoteFunctionOptions; + this.dataGovernanceType = routineInfo.dataGovernanceType; } BuilderImpl(Routine routinePb) { @@ -225,6 +237,7 @@ static class BuilderImpl extends Builder { this.remoteFunctionOptions = RemoteFunctionOptions.fromPb(routinePb.getRemoteFunctionOptions()); } + this.dataGovernanceType = routinePb.getDataGovernanceType(); } @Override @@ -311,6 +324,12 @@ public Builder setRemoteFunctionOptions(RemoteFunctionOptions remoteFunctionOpti return this; } + @Override + public Builder setDataGovernanceType(String dataGovernanceType) { + this.dataGovernanceType = dataGovernanceType; + return this; + } + @Override public RoutineInfo build() { return new RoutineInfo(this); @@ -332,6 +351,7 @@ public RoutineInfo build() { this.importedLibrariesList = builder.importedLibrariesList; this.body = builder.body; this.remoteFunctionOptions = builder.remoteFunctionOptions; + this.dataGovernanceType = builder.dataGovernanceType; } /** Returns the RoutineId identified for the routine resource. * */ @@ -411,6 +431,11 @@ public RemoteFunctionOptions getRemoteFunctionOptions() { return remoteFunctionOptions; }; + /** Returns the data governance type of the routine, e.g. DATA_MASKING. */ + public String getDataGovernanceType() { + return dataGovernanceType; + } + /** Returns a builder pre-populated using the current values of this routine. */ public Builder toBuilder() { return new BuilderImpl(this); @@ -433,6 +458,7 @@ public String toString() { .add("importedLibrariesList", importedLibrariesList) .add("body", body) .add("remoteFunctionOptions", remoteFunctionOptions) + .add("dataGovernanceType", dataGovernanceType) .toString(); } @@ -452,7 +478,8 @@ public int hashCode() { returnTableType, importedLibrariesList, body, - remoteFunctionOptions); + remoteFunctionOptions, + dataGovernanceType); } @Override @@ -490,7 +517,8 @@ Routine toPb() { .setDescription(getDescription()) .setDeterminismLevel(getDeterminismLevel()) .setLastModifiedTime(getLastModifiedTime()) - .setLanguage(getLanguage()); + .setLanguage(getLanguage()) + .setDataGovernanceType(getDataGovernanceType()); if (getRoutineId() != null) { routinePb.setRoutineReference(getRoutineId().toPb()); } @@ -506,6 +534,9 @@ Routine toPb() { if (getRemoteFunctionOptions() != null) { routinePb.setRemoteFunctionOptions(getRemoteFunctionOptions().toPb()); } + if (getImportedLibraries() != null) { + routinePb.setImportedLibraries(getImportedLibraries()); + } return routinePb; } diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/JobStatisticsTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/JobStatisticsTest.java index af75a2391e..f32832b594 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/JobStatisticsTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/JobStatisticsTest.java @@ -97,6 +97,7 @@ public class JobStatisticsTest { .setEndTime(END_TIME) .setStartTime(START_TIME) .setDestinationUriFileCounts(FILE_COUNT) + .setInputBytes(INPUT_BYTES) .build(); private static final LoadStatistics LOAD_STATISTICS = LoadStatistics.newBuilder() @@ -249,6 +250,7 @@ public void testBuilder() { assertEquals(START_TIME, EXTRACT_STATISTICS.getStartTime()); assertEquals(END_TIME, EXTRACT_STATISTICS.getEndTime()); assertEquals(FILE_COUNT, EXTRACT_STATISTICS.getDestinationUriFileCounts()); + assertEquals(INPUT_BYTES, EXTRACT_STATISTICS.getInputBytes()); assertEquals(CREATION_TIME, LOAD_STATISTICS.getCreationTime()); assertEquals(START_TIME, LOAD_STATISTICS.getStartTime()); @@ -385,6 +387,7 @@ private void compareExtractStatistics(ExtractStatistics expected, ExtractStatist assertEquals(expected, value); compareStatistics(expected, value); assertEquals(expected.getDestinationUriFileCounts(), value.getDestinationUriFileCounts()); + assertEquals(expected.getInputBytes(), value.getInputBytes()); } private void compareLoadStatistics(LoadStatistics expected, LoadStatistics value) { diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/RoutineInfoTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/RoutineInfoTest.java index 1f1181433b..ae061b62f8 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/RoutineInfoTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/RoutineInfoTest.java @@ -33,6 +33,8 @@ public class RoutineInfoTest { private static final Long LAST_MODIFIED_TIME = 20L; private static final String LANGUAGE = "SQL"; + private static final String DATA_GOVERNANCE_TYPE = "DATA_MASKING"; + private static final RoutineArgument ARG_1 = RoutineArgument.newBuilder() .setDataType(StandardSQLDataType.newBuilder("STRING").build()) @@ -63,6 +65,7 @@ public class RoutineInfoTest { .setReturnType(RETURN_TYPE) .setImportedLibraries(IMPORTED_LIBRARIES) .setBody(BODY) + .setDataGovernanceType(DATA_GOVERNANCE_TYPE) .build(); @Test @@ -90,6 +93,7 @@ public void testBuilder() { assertEquals(RETURN_TYPE, ROUTINE_INFO.getReturnType()); assertEquals(IMPORTED_LIBRARIES, ROUTINE_INFO.getImportedLibraries()); assertEquals(BODY, ROUTINE_INFO.getBody()); + assertEquals(DATA_GOVERNANCE_TYPE, ROUTINE_INFO.getDataGovernanceType()); } @Test @@ -107,8 +111,10 @@ public void testOf() { assertNull(routineInfo.getReturnType()); assertNull(routineInfo.getImportedLibraries()); assertNull(routineInfo.getBody()); + assertNull(routineInfo.getDataGovernanceType()); } + @Test public void testToAndFromPb() { compareRoutineInfo(ROUTINE_INFO, RoutineInfo.fromPb(ROUTINE_INFO.toPb())); } @@ -132,6 +138,7 @@ public void compareRoutineInfo(RoutineInfo expected, RoutineInfo value) { assertEquals(expected.getReturnType(), value.getReturnType()); assertEquals(expected.getImportedLibraries(), value.getImportedLibraries()); assertEquals(expected.getBody(), value.getBody()); + assertEquals(expected.getDataGovernanceType(), value.getDataGovernanceType()); assertEquals(expected.hashCode(), value.hashCode()); assertEquals(expected.toString(), value.toString()); } diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/RoutineTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/RoutineTest.java index c9080e851a..eaf1420120 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/RoutineTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/RoutineTest.java @@ -91,6 +91,8 @@ public class RoutineTest { .setMaxBatchingRows(10L) .build(); + private static final String DATA_GOVERNANCE_TYPE = "DATA_MASKING"; + private static final RoutineInfo ROUTINE_INFO = RoutineInfo.newBuilder(ROUTINE_ID) .setEtag(ETAG) @@ -104,6 +106,7 @@ public class RoutineTest { .setImportedLibraries(IMPORTED_LIBRARIES) .setBody(BODY) .setRemoteFunctionOptions(REMOTE_FUNCTION_OPTIONS) + .setDataGovernanceType(DATA_GOVERNANCE_TYPE) .build(); private static final RoutineInfo ROUTINE_INFO_TVF = @@ -146,6 +149,7 @@ public void testBuilder() { .setImportedLibraries(IMPORTED_LIBRARIES) .setBody(BODY) .setRemoteFunctionOptions(REMOTE_FUNCTION_OPTIONS) + .setDataGovernanceType(DATA_GOVERNANCE_TYPE) .build(); assertEquals(ETAG, builtRoutine.getEtag()); assertEquals(DETERMINISM_LEVEL, builtRoutine.getDeterminismLevel()); @@ -247,5 +251,6 @@ public void compareRoutineInfo(RoutineInfo expected, RoutineInfo value) { assertEquals(expected.getBody(), value.getBody()); assertEquals(expected.hashCode(), value.hashCode()); assertEquals(expected.getRemoteFunctionOptions(), value.getRemoteFunctionOptions()); + assertEquals(expected.getDataGovernanceType(), value.getDataGovernanceType()); } } diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java index 8cada3e084..7bdb7a7fb0 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java @@ -87,6 +87,7 @@ import com.google.cloud.bigquery.JobId; import com.google.cloud.bigquery.JobInfo; import com.google.cloud.bigquery.JobStatistics; +import com.google.cloud.bigquery.JobStatistics.ExtractStatistics; import com.google.cloud.bigquery.JobStatistics.LoadStatistics; import com.google.cloud.bigquery.JobStatistics.QueryStatistics; import com.google.cloud.bigquery.JobStatistics.QueryStatistics.StatementType; @@ -2683,6 +2684,33 @@ public void testRoutineAPICreationTVF() { assertEquals(routine.getReturnTableType(), returnTableType); } + @Test + public void testRoutineDataGovernanceType() { + String routineName = RemoteBigQueryHelper.generateRoutineName(); + RoutineId routineId = RoutineId.of(ROUTINE_DATASET, routineName); + RoutineInfo routineInfo = + RoutineInfo.newBuilder(routineId) + .setLanguage("SQL") + .setRoutineType("SCALAR_FUNCTION") + .setBody("x") + .setArguments( + ImmutableList.of( + RoutineArgument.newBuilder() + .setName("x") + .setDataType(StandardSQLDataType.newBuilder("INT64").build()) + .build())) + .setReturnType(StandardSQLDataType.newBuilder("INT64").build()) + .setDataGovernanceType("DATA_MASKING") + .build(); + + Routine routine = bigquery.create(routineInfo); + assertNotNull(routine); + assertEquals(routine.getLanguage(), "SQL"); + assertEquals(routine.getRoutineType(), "SCALAR_FUNCTION"); + assertEquals(routine.getReturnType(), StandardSQLDataType.newBuilder("INT64").build()); + assertEquals(routine.getDataGovernanceType(), "DATA_MASKING"); + } + @Test public void testAuthorizeRoutine() { String routineName = RemoteBigQueryHelper.generateRoutineName(); @@ -5304,6 +5332,8 @@ public void testExtractJob() throws InterruptedException, TimeoutException { assertNull(remoteLoadJob.getStatus().getError()); LoadJobConfiguration loadJobConfiguration = remoteLoadJob.getConfiguration(); assertEquals(labels, loadJobConfiguration.getLabels()); + LoadStatistics loadStatistics = remoteLoadJob.getStatistics(); + assertNotNull(loadStatistics); ExtractJobConfiguration extractConfiguration = ExtractJobConfiguration.newBuilder(destinationTable, "gs://" + BUCKET + "/" + EXTRACT_FILE) @@ -5313,6 +5343,12 @@ public void testExtractJob() throws InterruptedException, TimeoutException { remoteExtractJob = remoteExtractJob.waitFor(); assertNull(remoteExtractJob.getStatus().getError()); + ExtractStatistics extractStatistics = remoteExtractJob.getStatistics(); + assertNotNull(extractStatistics); + assertEquals(1L, extractStatistics.getDestinationUriFileCounts().size()); + assertEquals( + loadStatistics.getOutputBytes().longValue(), extractStatistics.getInputBytes().longValue()); + String extractedCsv = new String(storage.readAllBytes(BUCKET, EXTRACT_FILE), StandardCharsets.UTF_8); assertEquals( diff --git a/pom.xml b/pom.xml index 616aa52765..04dacf945c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-bigquery-parent pom - 2.34.2 + 2.35.0 BigQuery Parent https://github.com/googleapis/java-bigquery @@ -14,7 +14,7 @@ com.google.cloud google-cloud-shared-config - 1.6.0 + 1.6.1 @@ -54,9 +54,9 @@ UTF-8 github google-cloud-bigquery-parent - v2-rev20231008-2.0.0 - 3.19.0 - 12.0.1 + v2-rev20231111-2.0.0 + 3.20.0 + 14.0.1 @@ -73,7 +73,7 @@ com.google.cloud google-cloud-bigquerystorage-bom - 2.45.0 + 2.47.0 pom import @@ -111,7 +111,7 @@ com.google.cloud google-cloud-bigquery - 2.34.2 + 2.35.0 @@ -197,7 +197,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 3.4.5 + 3.5.0 diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index a8e7c622c0..145e02e3f7 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -45,7 +45,7 @@ com.google.cloud google-cloud-bigquery - 2.34.1 + 2.34.2 @@ -63,7 +63,7 @@ com.google.cloud google-cloud-bigtable - 2.29.0 + 2.29.1 test @@ -92,7 +92,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.4.0 + 3.5.0 add-snippets-source diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 2e28a2ec02..7744e9ca27 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-bigquery - 2.34.2 + 2.35.0 @@ -61,7 +61,7 @@ com.google.cloud google-cloud-bigtable - 2.29.0 + 2.29.1 test @@ -90,7 +90,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.4.0 + 3.5.0 add-snippets-source diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 2cf63f32d6..e65db0f720 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -79,7 +79,7 @@ com.google.cloud google-cloud-bigtable - 2.29.0 + 2.29.1 test diff --git a/samples/snippets/src/main/java/com/example/bigquery/TableInsertRows.java b/samples/snippets/src/main/java/com/example/bigquery/TableInsertRows.java index b5363d47bb..05bcee6d9a 100644 --- a/samples/snippets/src/main/java/com/example/bigquery/TableInsertRows.java +++ b/samples/snippets/src/main/java/com/example/bigquery/TableInsertRows.java @@ -39,12 +39,13 @@ public static void main(String[] args) { Map rowContent = new HashMap<>(); rowContent.put("booleanField", true); rowContent.put("numericField", "3.14"); - - tableInsertRows(datasetName, tableName, rowContent); + // TODO(developer): Replace the row id with a unique value for each row. + String rowId = "ROW_ID"; + tableInsertRows(datasetName, tableName, rowId, rowContent); } public static void tableInsertRows( - String datasetName, String tableName, Map rowContent) { + String datasetName, String tableName, String rowId, Map rowContent) { try { // Initialize client that will be used to send requests. This client only needs to be created // once, and can be reused for multiple requests. @@ -58,9 +59,8 @@ public static void tableInsertRows( bigquery.insertAll( InsertAllRequest.newBuilder(tableId) // More rows can be added in the same RPC by invoking .addRow() on the builder. - // You can also supply optional unique row keys to support de-duplication - // scenarios. - .addRow(rowContent) + // You can omit the unique row ids to disable de-duplication. + .addRow(rowId, rowContent) .build()); if (response.hasErrors()) { diff --git a/samples/snippets/src/main/java/com/example/bigquery/TableInsertRowsWithoutRowIds.java b/samples/snippets/src/main/java/com/example/bigquery/TableInsertRowsWithoutRowIds.java index 1befb593da..1f4def54c0 100644 --- a/samples/snippets/src/main/java/com/example/bigquery/TableInsertRowsWithoutRowIds.java +++ b/samples/snippets/src/main/java/com/example/bigquery/TableInsertRowsWithoutRowIds.java @@ -54,6 +54,8 @@ public static void tableInsertRowsWithoutRowIds(String datasetName, String table InsertAllResponse response = bigquery.insertAll( InsertAllRequest.newBuilder(TableId.of(datasetName, tableName)) + // No row ids disable de-duplication, and also disable the retries in the Java + // library. .setRows( ImmutableList.of( InsertAllRequest.RowToInsert.of(rowContent1), diff --git a/samples/snippets/src/test/java/com/example/bigquery/TableInsertRowsIT.java b/samples/snippets/src/test/java/com/example/bigquery/TableInsertRowsIT.java index 84a344cd26..d479530120 100644 --- a/samples/snippets/src/test/java/com/example/bigquery/TableInsertRowsIT.java +++ b/samples/snippets/src/test/java/com/example/bigquery/TableInsertRowsIT.java @@ -88,8 +88,9 @@ public void testTableInsertRows() { Map rowContent = new HashMap<>(); rowContent.put("booleanField", true); rowContent.put("numericField", "3.14"); + String rowId = "ROW_ID"; // Testing - TableInsertRows.tableInsertRows(BIGQUERY_DATASET_NAME, tableName, rowContent); + TableInsertRows.tableInsertRows(BIGQUERY_DATASET_NAME, tableName, rowId, rowContent); assertThat(bout.toString()).contains("Rows successfully inserted into table"); } } diff --git a/versions.txt b/versions.txt index 4907d332d0..fc9d4d40a2 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-bigquery:2.34.2:2.34.2 \ No newline at end of file +google-cloud-bigquery:2.35.0:2.35.0 \ No newline at end of file