From 2294c2ffca62a22a66786a9a4c6c9ef1be898e5d Mon Sep 17 00:00:00 2001 From: Obada Alabbadi <76101898+obada-ab@users.noreply.github.com> Date: Wed, 6 Sep 2023 15:14:13 +0200 Subject: [PATCH 01/42] feat: add support for converting interval fields to threeten PeriodDuration (#2838) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for converting BigQuery interval type to threeten PeriodDuration, information about the canonical interval form can be found [here](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#canonical_format_3). Parsing logic was referenced from [here](https://cloud.google.com/bigquery/docs/reference/standard-sql/interval_functions#extract). Fixes #1849 ☕️ --- README.md | 6 +- .../com/google/cloud/bigquery/FieldValue.java | 87 +++++++++++++++++++ .../google/cloud/bigquery/FieldValueTest.java | 38 ++++++++ .../cloud/bigquery/it/ITBigQueryTest.java | 3 + 4 files changed, 131 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index aceecda141..1665fb7d16 100644 --- a/README.md +++ b/README.md @@ -60,13 +60,13 @@ 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.31.1' +implementation 'com.google.cloud:google-cloud-bigquery:2.31.2' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.31.1" +libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.31.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.31.1 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquery/2.31.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/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java index 58c012a60e..ea68075f7f 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java @@ -27,10 +27,16 @@ import java.io.Serializable; import java.math.BigDecimal; import java.math.RoundingMode; +import java.time.Duration; import java.time.Instant; +import java.time.Period; +import java.time.format.DateTimeParseException; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.threeten.extra.PeriodDuration; /** * Google BigQuery Table Field Value class. Objects of this class represent values of a BigQuery @@ -237,6 +243,28 @@ public List getRepeatedValue() { return (List) value; } + /** + * Returns this field's value as a {@link org.threeten.extra.PeriodDuration}. This method should + * be used if the corresponding field has {@link StandardSQLTypeName#INTERVAL} type, or if it is a + * legal canonical format "[sign]Y-M [sign]D [sign]H:M:S[.F]", e.g. "123-7 -19 0:24:12.000006" or + * ISO 8601. + * + * @throws ClassCastException if the field is not a primitive type + * @throws NullPointerException if {@link #isNull()} returns {@code true} + * @throws IllegalArgumentException if the field cannot be converted to a legal interval + */ + @SuppressWarnings("unchecked") + public PeriodDuration getPeriodDuration() { + checkNotNull(value); + try { + // Try parsing from ISO 8601 + return PeriodDuration.parse(getStringValue()); + } catch (DateTimeParseException dateTimeParseException) { + // Try parsing from canonical interval format + return parseCanonicalInterval(getStringValue()); + } + } + /** * Returns this field's value as a {@link FieldValueList} instance. This method should only be * used if the corresponding field has {@link LegacySQLTypeName#RECORD} type (i.e. {@link @@ -325,4 +353,63 @@ static FieldValue fromPb(Object cellPb, Field recordSchema) { } throw new IllegalArgumentException("Unexpected table cell format"); } + + /** + * Parse interval in canonical format and create instance of {@code PeriodDuration}. + * + *

The parameter {@code interval} should be an interval in the canonical format: "[sign]Y-M + * [sign]D [sign]H:M:S[.F]". More details + * here + * + * @throws IllegalArgumentException if the {@code interval} is not a valid interval + */ + static PeriodDuration parseCanonicalInterval(String interval) throws IllegalArgumentException { + // Pattern is [sign]Y-M [sign]D [sign]H:M:S[.F] + Pattern pattern = + Pattern.compile( + "(?[+-])?(?\\d+)-(?\\d+) (?[-|+])?(?\\d+) (?[-|+])?(?\\d+):(?\\d+):(?\\d+)(\\.(?\\d+))?"); + Matcher matcher = pattern.matcher(interval); + if (!matcher.find()) { + throw new IllegalArgumentException(); + } + String sign1 = matcher.group("sign1"); + String year = matcher.group("year"); + String month = matcher.group("month"); + String sign2 = matcher.group("sign2"); + String day = matcher.group("day"); + String sign3 = matcher.group("sign3"); + String hours = matcher.group("hours"); + String minutes = matcher.group("minutes"); + String seconds = matcher.group("seconds"); + String fraction = matcher.group("fraction"); + + int yearInt = Integer.parseInt(year); + int monthInt = Integer.parseInt(month); + if (Objects.equals(sign1, "-")) { + yearInt *= -1; + monthInt *= -1; + } + + int dayInt = Integer.parseInt(day); + if (Objects.equals(sign2, "-")) { + dayInt *= -1; + } + if (sign3 == null) { + sign3 = ""; + } + + String durationString = + sign3 + + "PT" + + hours + + "H" + + minutes + + "M" + + seconds + + (fraction == null ? "" : "." + fraction) + + "S"; + + return PeriodDuration.of(Period.of(yearInt, monthInt, dayInt), Duration.parse(durationString)); + } } diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/FieldValueTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/FieldValueTest.java index e4ec47b472..90cb690618 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/FieldValueTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/FieldValueTest.java @@ -27,8 +27,13 @@ import com.google.common.collect.ImmutableMap; import com.google.common.io.BaseEncoding; import java.math.BigDecimal; +import java.time.Duration; +import java.time.Period; +import java.util.LinkedHashMap; import java.util.Map; +import java.util.Map.Entry; import org.junit.Test; +import org.threeten.extra.PeriodDuration; public class FieldValueTest { @@ -43,6 +48,10 @@ public class FieldValueTest { ImmutableMap.of("v", "123456789.123456789"); private static final Map STRING_FIELD = ImmutableMap.of("v", "string"); private static final Map TIMESTAMP_FIELD = ImmutableMap.of("v", "42"); + private static final Map INTERVAL_FIELD_1 = + ImmutableMap.of("v", "P3Y2M1DT12H34M56.789S"); + private static final Map INTERVAL_FIELD_2 = + ImmutableMap.of("v", "3-2 1 12:34:56.789"); private static final Map BYTES_FIELD = ImmutableMap.of("v", BYTES_BASE64); private static final Map NULL_FIELD = ImmutableMap.of("v", Data.nullOf(String.class)); @@ -74,6 +83,17 @@ public void testFromPb() { value = FieldValue.fromPb(TIMESTAMP_FIELD); assertEquals(FieldValue.Attribute.PRIMITIVE, value.getAttribute()); assertEquals(42000000, value.getTimestampValue()); + value = FieldValue.fromPb(INTERVAL_FIELD_1); + assertEquals(FieldValue.Attribute.PRIMITIVE, value.getAttribute()); + PeriodDuration periodDuration = + PeriodDuration.of(Period.of(3, 2, 1), Duration.parse("PT12H34M56.789S")); + assertEquals(periodDuration, value.getPeriodDuration()); + assertEquals("P3Y2M1DT12H34M56.789S", value.getStringValue()); + value = FieldValue.fromPb(INTERVAL_FIELD_2); + assertEquals(FieldValue.Attribute.PRIMITIVE, value.getAttribute()); + periodDuration = PeriodDuration.of(Period.of(3, 2, 1), Duration.parse("PT12H34M56.789S")); + assertEquals(periodDuration, value.getPeriodDuration()); + assertEquals("3-2 1 12:34:56.789", value.getStringValue()); value = FieldValue.fromPb(BYTES_FIELD); assertEquals(FieldValue.Attribute.PRIMITIVE, value.getAttribute()); assertArrayEquals(BYTES, value.getBytesValue()); @@ -146,4 +166,22 @@ public void testEquals() { assertEquals(recordValue, FieldValue.fromPb(RECORD_FIELD)); assertEquals(recordValue.hashCode(), FieldValue.fromPb(RECORD_FIELD).hashCode()); } + + @Test + public void testParseCanonicalInterval() { + Map intervalToPeriodDuration = new LinkedHashMap<>(); + intervalToPeriodDuration.put( + "125-7 -19 -0:24:12.001", PeriodDuration.parse("P125Y7M-19DT0H-24M-12.001S")); + intervalToPeriodDuration.put("-15-6 23 23:14:05", PeriodDuration.parse("P-15Y-6M23DT23H14M5S")); + intervalToPeriodDuration.put( + "06-01 06 01:01:00.123456", PeriodDuration.parse("P6Y1M6DT1H1M0.123456S")); + intervalToPeriodDuration.put("-0-0 -0 -0:0:0", PeriodDuration.parse("P0Y0M0DT0H0M0S")); + intervalToPeriodDuration.put( + "-99999-99999 9999 999:999:999.999999999", + PeriodDuration.parse("P-99999Y-99999M9999DT999H999M999.999999999S")); + for (Entry entry : intervalToPeriodDuration.entrySet()) { + assertEquals(FieldValue.parseCanonicalInterval(entry.getKey()), entry.getValue()); + System.out.println(FieldValue.parseCanonicalInterval(entry.getKey())); + } + } } 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 bb9c233a45..cf180f9a36 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 @@ -1228,8 +1228,11 @@ public void testIntervalType() throws InterruptedException { .build(); TableResult result = bigquery.query(queryJobConfiguration); assertNotNull(result.getJobId()); + PeriodDuration periodDuration = + PeriodDuration.of(Period.of(125, 7, -19), java.time.Duration.parse("PT24M12.000006S")); for (FieldValueList values : result.iterateAll()) { assertEquals("125-7 -19 0:24:12.000006", values.get(0).getValue()); + assertEquals(periodDuration, values.get(0).getPeriodDuration()); } } finally { assertTrue(bigquery.delete(tableId)); From f24439b7adf1f08cee4b65918b4395861fe88517 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 12 Sep 2023 00:57:51 +0200 Subject: [PATCH 02/42] deps: update dependency com.google.cloud:google-cloud-shared-dependencies to v3.15.0 (#2870) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7628435f20..508962ae51 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,7 @@ github google-cloud-bigquery-parent v2-rev20230805-2.0.0 - 3.14.0 + 3.15.0 12.0.1 From edd714129b65d73f894591c4d40e1a8e79c36b04 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 12 Sep 2023 00:58:12 +0200 Subject: [PATCH 03/42] deps: update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.26 (#2869) --- samples/native-image-sample/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/native-image-sample/pom.xml b/samples/native-image-sample/pom.xml index 186ea50ab2..e3307285d8 100644 --- a/samples/native-image-sample/pom.xml +++ b/samples/native-image-sample/pom.xml @@ -121,7 +121,7 @@ org.graalvm.buildtools native-maven-plugin - 0.9.24 + 0.9.26 true com.example.bigquery.NativeImageBigquerySample From d01031cbc6d50f9aff8c6d49a8d2c54496779451 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 12 Sep 2023 00:58:28 +0200 Subject: [PATCH 04/42] deps: update dependency org.graalvm.buildtools:junit-platform-native to v0.9.26 (#2868) --- samples/native-image-sample/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/native-image-sample/pom.xml b/samples/native-image-sample/pom.xml index e3307285d8..7f18e0025f 100644 --- a/samples/native-image-sample/pom.xml +++ b/samples/native-image-sample/pom.xml @@ -99,7 +99,7 @@ org.graalvm.buildtools junit-platform-native - 0.9.24 + 0.9.26 test From cbbf0fb8a99c0633335d81cd36a7b53dfe9df20b Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 12 Sep 2023 00:58:49 +0200 Subject: [PATCH 05/42] deps: update actions/upload-artifact action to v3.1.3 (#2867) --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index fa10a24734..4eab67ad52 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -59,7 +59,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 with: name: SARIF file path: results.sarif From 7772c2adf04f3662055921e53b5599db52f7576c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 11 Sep 2023 18:59:11 -0400 Subject: [PATCH 06/42] chore: for Java repos RenovateBot to ignore GitHub Actions workflow file (#1855) (#2866) chore: for Java repos RenovateBot to ignore GitHub Actions workflow file The actions used in the GitHub Actions workflow files do not appear in libraries' dependencies and mostly maintained by Java postprocessor templates. IgnorePath option document: https://docs.renovatebot.com/configuration-options/ Source-Link: https://github.com/googleapis/synthtool/commit/1543029c843989702adbe789acdead153ad696d1 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:88ba8dcc5c2c7792e1c3511381f4ab329002a1c42c512f66ca87ced572dfbf9f Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/requirements.txt | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index d5500ef442..52eaa54d82 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest - digest: sha256:46d2d262cd285c638656c8bde468011b723dc0c7ffd6a5ecc2650fe639c82e8f -# created: 2023-07-24T14:21:17.707234503Z + digest: sha256:88ba8dcc5c2c7792e1c3511381f4ab329002a1c42c512f66ca87ced572dfbf9f +# created: 2023-09-05T18:54:42.225408832Z diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 32989051e7..a73256ab80 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -12,9 +12,9 @@ cachetools==5.3.1 \ --hash=sha256:95ef631eeaea14ba2e36f06437f36463aac3a096799e876ee55e5cdccb102590 \ --hash=sha256:dce83f2d9b4e1f732a8cd44af8e8fab2dbe46201467fc98b3ef8f269092bf62b # via google-auth -certifi==2023.5.7 \ - --hash=sha256:0f0d56dc5a6ad56fd4ba36484d6cc34451e1c6548c61daad8c320169f91eddc7 \ - --hash=sha256:c6c2e98f5c7869efca1f8916fed228dd91539f9f1b444c314c06eef02980c716 +certifi==2023.7.22 \ + --hash=sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082 \ + --hash=sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9 # via requests cffi==1.15.1 \ --hash=sha256:00a9ed42e88df81ffae7a8ab6d9356b371399b91dbdf0c3cb1e84c03a13aceb5 \ @@ -485,6 +485,5 @@ zipp==3.16.1 \ # via importlib-metadata # WARNING: The following packages were not pinned, but pip requires them to be -# pinned when the requirements file includes hashes and the requirement is not -# satisfied by a package already installed. Consider using the --allow-unsafe flag. +# pinned when the requirements file includes hashes. Consider using the --allow-unsafe flag. # setuptools From bbb86fd8488ad253f2e9cf3fb08360330bd860a3 Mon Sep 17 00:00:00 2001 From: Obada Alabbadi <76101898+obada-ab@users.noreply.github.com> Date: Wed, 13 Sep 2023 19:04:15 +0200 Subject: [PATCH 07/42] feat: add support for ExternalDatasetReference (#2871) API: https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#externaldatasetreference --- .../clirr-ignored-differences.xml | 5 ++ .../com/google/cloud/bigquery/Dataset.java | 6 ++ .../google/cloud/bigquery/DatasetInfo.java | 33 ++++++++ .../bigquery/ExternalDatasetReference.java | 79 +++++++++++++++++++ .../cloud/bigquery/DatasetInfoTest.java | 39 +++++++++ .../google/cloud/bigquery/DatasetTest.java | 31 ++++++++ .../ExternalDatasetReferenceTest.java | 70 ++++++++++++++++ pom.xml | 2 +- 8 files changed, 264 insertions(+), 1 deletion(-) create mode 100644 google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ExternalDatasetReference.java create mode 100644 google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/ExternalDatasetReferenceTest.java diff --git a/google-cloud-bigquery/clirr-ignored-differences.xml b/google-cloud-bigquery/clirr-ignored-differences.xml index 41067bd213..eaeeded132 100644 --- a/google-cloud-bigquery/clirr-ignored-differences.xml +++ b/google-cloud-bigquery/clirr-ignored-differences.xml @@ -104,4 +104,9 @@ com/google/cloud/bigquery/IndexUnusedReason* *BaseTable(*) + + 7013 + com/google/cloud/bigquery/DatasetInfo* + *setExternalDatasetReference(*) + \ No newline at end of file diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Dataset.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Dataset.java index 5f9fea892f..3ed4b89287 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Dataset.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Dataset.java @@ -152,6 +152,12 @@ public Builder setDefaultCollation(String defaultCollation) { return this; } + @Override + public Builder setExternalDatasetReference(ExternalDatasetReference externalDatasetReference) { + infoBuilder.setExternalDatasetReference(externalDatasetReference); + return this; + } + @Override public Dataset build() { return new Dataset(bigquery, infoBuilder); diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/DatasetInfo.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/DatasetInfo.java index bd209952e8..44583e0c85 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/DatasetInfo.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/DatasetInfo.java @@ -73,6 +73,7 @@ public Dataset apply(DatasetInfo datasetInfo) { private final EncryptionConfiguration defaultEncryptionConfiguration; private final Long defaultPartitionExpirationMs; private final String defaultCollation; + private final ExternalDatasetReference externalDatasetReference; /** A builder for {@code DatasetInfo} objects. */ public abstract static class Builder { @@ -127,6 +128,13 @@ public abstract static class Builder { public abstract Builder setLabels(Map labels); + /** + * Optional. Information about the external metadata storage where the dataset is defined. + * Filled out when the dataset type is EXTERNAL + */ + public abstract Builder setExternalDatasetReference( + ExternalDatasetReference externalDatasetReference); + /** * The default encryption key for all tables in the dataset. Once this property is set, all * newly-created partitioned tables in the dataset will have encryption key set to this value, @@ -183,6 +191,7 @@ static final class BuilderImpl extends Builder { private EncryptionConfiguration defaultEncryptionConfiguration; private Long defaultPartitionExpirationMs; private String defaultCollation; + private ExternalDatasetReference externalDatasetReference; BuilderImpl() {} @@ -202,6 +211,7 @@ static final class BuilderImpl extends Builder { this.defaultEncryptionConfiguration = datasetInfo.defaultEncryptionConfiguration; this.defaultPartitionExpirationMs = datasetInfo.defaultPartitionExpirationMs; this.defaultCollation = datasetInfo.defaultCollation; + this.externalDatasetReference = datasetInfo.externalDatasetReference; } BuilderImpl(com.google.api.services.bigquery.model.Dataset datasetPb) { @@ -236,6 +246,10 @@ public Acl apply(Dataset.Access accessPb) { } this.defaultPartitionExpirationMs = datasetPb.getDefaultPartitionExpirationMs(); this.defaultCollation = datasetPb.getDefaultCollation(); + if (datasetPb.getExternalDatasetReference() != null) { + this.externalDatasetReference = + ExternalDatasetReference.fromPb(datasetPb.getExternalDatasetReference()); + } } @Override @@ -336,6 +350,12 @@ public Builder setDefaultCollation(String defaultCollation) { return this; } + @Override + public Builder setExternalDatasetReference(ExternalDatasetReference externalDatasetReference) { + this.externalDatasetReference = externalDatasetReference; + return this; + } + @Override public DatasetInfo build() { return new DatasetInfo(this); @@ -358,6 +378,7 @@ public DatasetInfo build() { defaultEncryptionConfiguration = builder.defaultEncryptionConfiguration; defaultPartitionExpirationMs = builder.defaultPartitionExpirationMs; defaultCollation = builder.defaultCollation; + externalDatasetReference = builder.externalDatasetReference; } /** Returns the dataset identity. */ @@ -487,6 +508,14 @@ public String getDefaultCollation() { return defaultCollation; } + /** + * Returns information about the external metadata storage where the dataset is defined. Filled + * out when the dataset type is EXTERNAL. + */ + public ExternalDatasetReference getExternalDatasetReference() { + return externalDatasetReference; + } + /** Returns a builder for the dataset object. */ public Builder toBuilder() { return new BuilderImpl(this); @@ -510,6 +539,7 @@ public String toString() { .add("defaultEncryptionConfiguration", defaultEncryptionConfiguration) .add("defaultPartitionExpirationMs", defaultPartitionExpirationMs) .add("defaultCollation", defaultCollation) + .add("externalDatasetReference", externalDatasetReference) .toString(); } @@ -588,6 +618,9 @@ public Dataset.Access apply(Acl acl) { if (defaultCollation != null) { datasetPb.setDefaultCollation(defaultCollation); } + if (externalDatasetReference != null) { + datasetPb.setExternalDatasetReference(externalDatasetReference.toPb()); + } return datasetPb; } diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ExternalDatasetReference.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ExternalDatasetReference.java new file mode 100644 index 0000000000..ecfe54c50c --- /dev/null +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ExternalDatasetReference.java @@ -0,0 +1,79 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery; + +import com.google.auto.value.AutoValue; +import com.google.common.annotations.VisibleForTesting; +import java.io.Serializable; +import javax.annotation.Nullable; + +/** Configures the access a dataset defined in an external metadata storage. */ +@AutoValue +public abstract class ExternalDatasetReference implements Serializable { + + public static ExternalDatasetReference.Builder newBuilder() { + return new AutoValue_ExternalDatasetReference.Builder(); + } + + static ExternalDatasetReference fromPb( + com.google.api.services.bigquery.model.ExternalDatasetReference externalDatasetReference) { + ExternalDatasetReference.Builder builder = newBuilder(); + + if (externalDatasetReference.getConnection() != null) { + builder.setConnection(externalDatasetReference.getConnection()); + } + if (externalDatasetReference.getExternalSource() != null) { + builder.setExternalSource(externalDatasetReference.getExternalSource()); + } + + return builder.build(); + } + + public com.google.api.services.bigquery.model.ExternalDatasetReference toPb() { + com.google.api.services.bigquery.model.ExternalDatasetReference externalDatasetReference = + new com.google.api.services.bigquery.model.ExternalDatasetReference(); + + externalDatasetReference.setConnection(getConnection()); + externalDatasetReference.setExternalSource(getExternalSource()); + return externalDatasetReference; + } + + @Nullable + public abstract String getConnection(); + + @Nullable + public abstract String getExternalSource(); + + /** Returns a builder for an ExternalDatasetReference. */ + @VisibleForTesting + public abstract ExternalDatasetReference.Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + /** + * The connection id that is used to access the external_source. Format: + * projects/{project_id}/locations/{location_id}/connections/{connection_id} * + */ + public abstract ExternalDatasetReference.Builder setConnection(String connection); + + /** External source that backs this dataset * */ + public abstract ExternalDatasetReference.Builder setExternalSource(String externalSource); + + /** Creates a {@code ExternalDatasetReference} object. */ + public abstract ExternalDatasetReference build(); + } +} diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/DatasetInfoTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/DatasetInfoTest.java index 453701e3a8..c91cbc2f30 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/DatasetInfoTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/DatasetInfoTest.java @@ -58,6 +58,12 @@ public class DatasetInfoTest { private static final DatasetId DATASET_ID_COMPLETE = DatasetId.of("project", "dataset"); private static final EncryptionConfiguration DATASET_ENCRYPTION_CONFIGURATION = EncryptionConfiguration.newBuilder().setKmsKeyName("KMS_KEY_1").build(); + + private static final ExternalDatasetReference EXTERNAL_DATASET_REFERENCE = + ExternalDatasetReference.newBuilder() + .setExternalSource("source") + .setConnection("connection") + .build(); private static final DatasetInfo DATASET_INFO = DatasetInfo.newBuilder(DATASET_ID) .setAcl(ACCESS_RULES) @@ -82,6 +88,8 @@ public class DatasetInfoTest { .build(); private static final DatasetInfo DATASET_INFO_COMPLETE_WITH_IAM_MEMBER = DATASET_INFO.toBuilder().setAcl(ACCESS_RULES_IAM_MEMBER).build(); + private static final DatasetInfo DATASET_INFO_COMPLETE_WITH_EXTERNAL_DATASET_REFERENCE = + DATASET_INFO.toBuilder().setExternalDatasetReference(EXTERNAL_DATASET_REFERENCE).build(); @Test public void testToBuilder() { @@ -108,6 +116,28 @@ public void testToBuilderIncomplete() { assertEquals(datasetInfo, datasetInfo.toBuilder().build()); } + @Test + public void testToBuilderWithExternalDatasetReference() { + compareDatasets( + DATASET_INFO_COMPLETE_WITH_EXTERNAL_DATASET_REFERENCE, + DATASET_INFO_COMPLETE_WITH_EXTERNAL_DATASET_REFERENCE.toBuilder().build()); + + ExternalDatasetReference externalDatasetReference = + ExternalDatasetReference.newBuilder() + .setExternalSource("source2") + .setConnection("connection2") + .build(); + DatasetInfo datasetInfo = + DATASET_INFO_COMPLETE_WITH_EXTERNAL_DATASET_REFERENCE + .toBuilder() + .setExternalDatasetReference(externalDatasetReference) + .build(); + assertEquals(externalDatasetReference, datasetInfo.getExternalDatasetReference()); + datasetInfo = + datasetInfo.toBuilder().setExternalDatasetReference(EXTERNAL_DATASET_REFERENCE).build(); + compareDatasets(DATASET_INFO_COMPLETE_WITH_EXTERNAL_DATASET_REFERENCE, datasetInfo); + } + @Test public void testBuilder() { assertNull(DATASET_INFO.getDatasetId().getProject()); @@ -137,6 +167,9 @@ public void testBuilder() { assertEquals(LOCATION, DATASET_INFO_COMPLETE.getLocation()); assertEquals(SELF_LINK, DATASET_INFO_COMPLETE.getSelfLink()); assertEquals(LABELS, DATASET_INFO_COMPLETE.getLabels()); + assertEquals( + EXTERNAL_DATASET_REFERENCE, + DATASET_INFO_COMPLETE_WITH_EXTERNAL_DATASET_REFERENCE.getExternalDatasetReference()); } @Test @@ -156,6 +189,7 @@ public void testOf() { assertNull(datasetInfo.getDefaultEncryptionConfiguration()); assertNull(datasetInfo.getDefaultPartitionExpirationMs()); assertTrue(datasetInfo.getLabels().isEmpty()); + assertNull(datasetInfo.getExternalDatasetReference()); datasetInfo = DatasetInfo.of(DATASET_ID); assertEquals(DATASET_ID, datasetInfo.getDatasetId()); @@ -172,11 +206,15 @@ public void testOf() { assertNull(datasetInfo.getDefaultEncryptionConfiguration()); assertNull(datasetInfo.getDefaultPartitionExpirationMs()); assertTrue(datasetInfo.getLabels().isEmpty()); + assertNull(datasetInfo.getExternalDatasetReference()); } @Test public void testToPbAndFromPb() { compareDatasets(DATASET_INFO_COMPLETE, DatasetInfo.fromPb(DATASET_INFO_COMPLETE.toPb())); + compareDatasets( + DATASET_INFO_COMPLETE_WITH_EXTERNAL_DATASET_REFERENCE, + DatasetInfo.fromPb(DATASET_INFO_COMPLETE_WITH_EXTERNAL_DATASET_REFERENCE.toPb())); DatasetInfo datasetInfo = DatasetInfo.newBuilder("project", "dataset").build(); compareDatasets(datasetInfo, DatasetInfo.fromPb(datasetInfo.toPb())); } @@ -204,5 +242,6 @@ private void compareDatasets(DatasetInfo expected, DatasetInfo value) { expected.getDefaultEncryptionConfiguration(), value.getDefaultEncryptionConfiguration()); assertEquals( expected.getDefaultPartitionExpirationMs(), value.getDefaultPartitionExpirationMs()); + assertEquals(expected.getExternalDatasetReference(), value.getExternalDatasetReference()); } } diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/DatasetTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/DatasetTest.java index d1c97a6940..b244cf2606 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/DatasetTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/DatasetTest.java @@ -83,6 +83,11 @@ public class DatasetTest { TableInfo.newBuilder( TableId.of(NEW_PROJECT_ID, "dataset", "table3"), EXTERNAL_TABLE_DEFINITION) .build(); + private static final ExternalDatasetReference EXTERNAL_DATASET_REFERENCE = + ExternalDatasetReference.newBuilder() + .setExternalSource("source") + .setConnection("connection") + .build(); @Rule public MockitoRule rule; @@ -319,6 +324,31 @@ public void testToAndFromPb() { compareDataset(expectedDataset, Dataset.fromPb(bigquery, expectedDataset.toPb())); } + @Test + public void testExternalDatasetReference() { + Dataset datasetWithExternalDatasetReference = + new Dataset.Builder(bigquery, DATASET_ID) + .setAcl(ACCESS_RULES) + .setCreationTime(CREATION_TIME) + .setDefaultTableLifetime(DEFAULT_TABLE_EXPIRATION) + .setDescription(DESCRIPTION) + .setEtag(ETAG) + .setFriendlyName(FRIENDLY_NAME) + .setGeneratedId(GENERATED_ID) + .setLastModified(LAST_MODIFIED) + .setLocation(LOCATION) + .setSelfLink(SELF_LINK) + .setLabels(LABELS) + .setExternalDatasetReference(EXTERNAL_DATASET_REFERENCE) + .build(); + assertEquals( + EXTERNAL_DATASET_REFERENCE, + datasetWithExternalDatasetReference.getExternalDatasetReference()); + compareDataset( + datasetWithExternalDatasetReference, + datasetWithExternalDatasetReference.toBuilder().build()); + } + private void compareDataset(Dataset expected, Dataset value) { assertEquals(expected, value); compareDatasetInfo(expected, value); @@ -338,5 +368,6 @@ private void compareDatasetInfo(DatasetInfo expected, DatasetInfo value) { assertEquals(expected.getCreationTime(), value.getCreationTime()); assertEquals(expected.getDefaultTableLifetime(), value.getDefaultTableLifetime()); assertEquals(expected.getLastModified(), value.getLastModified()); + assertEquals(expected.getExternalDatasetReference(), value.getExternalDatasetReference()); } } diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/ExternalDatasetReferenceTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/ExternalDatasetReferenceTest.java new file mode 100644 index 0000000000..6d241948b8 --- /dev/null +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/ExternalDatasetReferenceTest.java @@ -0,0 +1,70 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +public class ExternalDatasetReferenceTest { + private static final String EXTERNAL_SOURCE = "test_source"; + private static final String CONNECTION = "test_connection"; + private static final ExternalDatasetReference EXTERNAL_DATASET_REFERENCE = + ExternalDatasetReference.newBuilder() + .setExternalSource(EXTERNAL_SOURCE) + .setConnection(CONNECTION) + .build(); + + @Test + public void testToBuilder() { + compareExternalDatasetReference( + EXTERNAL_DATASET_REFERENCE, EXTERNAL_DATASET_REFERENCE.toBuilder().build()); + ExternalDatasetReference externalDatasetReference = + EXTERNAL_DATASET_REFERENCE.toBuilder().setExternalSource("test_source2").build(); + assertEquals("test_source2", externalDatasetReference.getExternalSource()); + } + + @Test + public void testBuilder() { + assertEquals(EXTERNAL_SOURCE, EXTERNAL_DATASET_REFERENCE.getExternalSource()); + assertEquals(CONNECTION, EXTERNAL_DATASET_REFERENCE.getConnection()); + ExternalDatasetReference externalDatasetReference = + ExternalDatasetReference.newBuilder() + .setExternalSource(EXTERNAL_SOURCE) + .setConnection(CONNECTION) + .build(); + assertEquals(EXTERNAL_DATASET_REFERENCE, externalDatasetReference); + } + + @Test + public void testToAndFromPb() { + ExternalDatasetReference externalDatasetReference = + EXTERNAL_DATASET_REFERENCE.toBuilder().build(); + assertTrue( + ExternalDatasetReference.fromPb(externalDatasetReference.toPb()) + instanceof ExternalDatasetReference); + compareExternalDatasetReference( + externalDatasetReference, ExternalDatasetReference.fromPb(externalDatasetReference.toPb())); + } + + private void compareExternalDatasetReference( + ExternalDatasetReference expected, ExternalDatasetReference value) { + assertEquals(expected.getExternalSource(), value.getExternalSource()); + assertEquals(expected.getConnection(), value.getConnection()); + } +} diff --git a/pom.xml b/pom.xml index 508962ae51..be820053de 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,7 @@ UTF-8 github google-cloud-bigquery-parent - v2-rev20230805-2.0.0 + v2-rev20230812-2.0.0 3.15.0 12.0.1 From 6cafedf634bc88f41b2b5d3ec1425341b02ac8b6 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 14 Sep 2023 00:49:57 +0200 Subject: [PATCH 08/42] deps: update dependency com.google.cloud:google-cloud-datacatalog-bom to v1.30.0 (#2874) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index be820053de..64fc269071 100644 --- a/pom.xml +++ b/pom.xml @@ -97,7 +97,7 @@ com.google.cloud google-cloud-datacatalog-bom - 1.29.0 + 1.30.0 pom import From 1985acc9343b8014f110252a02cd578ce73d6a7f Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 14 Sep 2023 01:37:58 +0200 Subject: [PATCH 09/42] chore(deps): update dependency com.google.cloud:google-cloud-bigquerystorage-bom to v2.42.0 (#2877) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 64fc269071..34eceda6ce 100644 --- a/pom.xml +++ b/pom.xml @@ -73,7 +73,7 @@ com.google.cloud google-cloud-bigquerystorage-bom - 2.41.1 + 2.42.0 pom import From 6196625d614ce80641008ffab3b5bf9720651bb9 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 14 Sep 2023 01:38:20 +0200 Subject: [PATCH 10/42] deps: update dependency com.google.api.grpc:proto-google-cloud-bigqueryconnection-v1 to v2.26.0 (#2873) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 34eceda6ce..9b62684183 100644 --- a/pom.xml +++ b/pom.xml @@ -167,7 +167,7 @@ com.google.api.grpc proto-google-cloud-bigqueryconnection-v1 - 2.25.0 + 2.26.0 test From 5702109aff3f5c3357c8bca83b18e6e16ca8d878 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 14 Sep 2023 01:38:38 +0200 Subject: [PATCH 11/42] chore(deps): update dependency com.google.cloud:google-cloud-bigqueryconnection to v2.26.0 (#2872) --- pom.xml | 2 +- samples/install-without-bom/pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- samples/snippets/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 9b62684183..13abbec2aa 100644 --- a/pom.xml +++ b/pom.xml @@ -161,7 +161,7 @@ com.google.cloud google-cloud-bigqueryconnection - 2.25.0 + 2.26.0 test diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 5c186115b7..e307f5c09b 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -69,7 +69,7 @@ com.google.cloud google-cloud-bigqueryconnection - 2.25.0 + 2.26.0 test diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index c811b89f9c..efe17ad41a 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -67,7 +67,7 @@ com.google.cloud google-cloud-bigqueryconnection - 2.25.0 + 2.26.0 test diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 080f1e84cf..e9e85bf7ee 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -85,7 +85,7 @@ com.google.cloud google-cloud-bigqueryconnection - 2.25.0 + 2.26.0 test From f8c163ea697f574a57e024c2872634fa2a03940c Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 13 Sep 2023 21:31:49 -0400 Subject: [PATCH 12/42] chore(main): release 2.31.3-SNAPSHOT (#2865) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- benchmark/pom.xml | 2 +- google-cloud-bigquery/pom.xml | 4 ++-- pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/benchmark/pom.xml b/benchmark/pom.xml index dde17cb100..479eecb8a5 100644 --- a/benchmark/pom.xml +++ b/benchmark/pom.xml @@ -6,7 +6,7 @@ google-cloud-bigquery-parent com.google.cloud - 2.31.2 + 2.31.3-SNAPSHOT diff --git a/google-cloud-bigquery/pom.xml b/google-cloud-bigquery/pom.xml index 5ec3e04a6a..d1441f1a79 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.31.2 + 2.31.3-SNAPSHOT jar BigQuery https://github.com/googleapis/java-bigquery @@ -11,7 +11,7 @@ com.google.cloud google-cloud-bigquery-parent - 2.31.2 + 2.31.3-SNAPSHOT google-cloud-bigquery diff --git a/pom.xml b/pom.xml index 13abbec2aa..c7af98af7f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-bigquery-parent pom - 2.31.2 + 2.31.3-SNAPSHOT BigQuery Parent https://github.com/googleapis/java-bigquery @@ -111,7 +111,7 @@ com.google.cloud google-cloud-bigquery - 2.31.2 + 2.31.3-SNAPSHOT diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index efe17ad41a..6d3190ee29 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-bigquery - 2.31.2 + 2.31.3-SNAPSHOT diff --git a/versions.txt b/versions.txt index c9aaacf02c..49aa7879b5 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-bigquery:2.31.2:2.31.2 \ No newline at end of file +google-cloud-bigquery:2.31.2:2.31.3-SNAPSHOT \ No newline at end of file From 902e9b97cd548910354297ff6e605df094a03175 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 14 Sep 2023 03:32:21 +0200 Subject: [PATCH 13/42] deps: update actions/checkout action to v4 (#2862) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * deps: update actions/checkout action to v4 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 4eab67ad52..4959517d49 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -32,7 +32,7 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 with: persist-credentials: false From 6b6d809657376cf3591e732e6440770156ae0382 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 14 Sep 2023 04:30:29 +0200 Subject: [PATCH 14/42] test(deps): update dependency com.google.cloud:google-cloud-storage to v2.26.1 (#2851) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test(deps): update dependency com.google.cloud:google-cloud-storage to v2.26.1 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot Co-authored-by: Mridula <66699525+mpeddada1@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c7af98af7f..9aafd3a38d 100644 --- a/pom.xml +++ b/pom.xml @@ -155,7 +155,7 @@ com.google.cloud google-cloud-storage - 2.26.0 + 2.26.1 test From ff8371e72aacff8ce3b550c55aa7bda3523bc2d8 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 14 Sep 2023 04:30:51 +0200 Subject: [PATCH 15/42] chore(deps): update dependency com.google.cloud:google-cloud-bigquery to v2.31.1 (#2848) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update dependency com.google.cloud:google-cloud-bigquery to v2.31.1 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot Co-authored-by: Mridula <66699525+mpeddada1@users.noreply.github.com> --- README.md | 2 +- samples/install-without-bom/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1665fb7d16..73be1efe40 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.31.0 + 2.31.1 ``` diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index e307f5c09b..3189c3d6aa 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.31.0 + 2.31.1 From 6b380a668045580b1aa1878c56ca73dcf576e68c Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 14 Sep 2023 04:31:03 +0200 Subject: [PATCH 16/42] chore(deps): update dependency com.google.cloud:google-cloud-bigtable to v2.26.0 (#2850) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update dependency com.google.cloud:google-cloud-bigtable to v2.26.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot Co-authored-by: Mridula <66699525+mpeddada1@users.noreply.github.com> --- samples/install-without-bom/pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- samples/snippets/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 3189c3d6aa..7018c5c33f 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -63,7 +63,7 @@ com.google.cloud google-cloud-bigtable - 2.25.1 + 2.26.0 test diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 6d3190ee29..5de6ade6f5 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -61,7 +61,7 @@ com.google.cloud google-cloud-bigtable - 2.25.1 + 2.26.0 test diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index e9e85bf7ee..2e8a7890d2 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -79,7 +79,7 @@ com.google.cloud google-cloud-bigtable - 2.25.1 + 2.26.0 test From 0f7306cff99d7f38c504d006e1518b9389507673 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 14 Sep 2023 14:12:17 +0200 Subject: [PATCH 17/42] test(deps): update dependency com.google.cloud:google-cloud-storage to v2.27.0 (#2880) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9aafd3a38d..2f90204848 100644 --- a/pom.xml +++ b/pom.xml @@ -155,7 +155,7 @@ com.google.cloud google-cloud-storage - 2.26.1 + 2.27.0 test From 93bdcedcd90927c6144adc3de5e6460d608ebfe2 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 14 Sep 2023 14:12:30 +0200 Subject: [PATCH 18/42] chore(deps): update dependency com.google.cloud:google-cloud-bigquery to v2.31.2 (#2881) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update dependency com.google.cloud:google-cloud-bigquery to v2.31.2 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- README.md | 2 +- samples/install-without-bom/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 73be1efe40..d5521d9866 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.31.1 + 2.31.2 ``` diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 7018c5c33f..0b6b5994bb 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.31.1 + 2.31.2 From 42a999640dfe84005007d571daa58e526187c5e2 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 14 Sep 2023 09:28:30 -0400 Subject: [PATCH 19/42] chore(main): release 2.32.0 (#2878) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 19 +++++++++++++++++++ benchmark/pom.xml | 2 +- google-cloud-bigquery/pom.xml | 4 ++-- pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 2 +- 6 files changed, 26 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c833f4b7c..05a148540f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## [2.32.0](https://github.com/googleapis/java-bigquery/compare/v2.31.2...v2.32.0) (2023-09-14) + + +### Features + +* Add support for converting interval fields to threeten PeriodDuration ([#2838](https://github.com/googleapis/java-bigquery/issues/2838)) ([2294c2f](https://github.com/googleapis/java-bigquery/commit/2294c2ffca62a22a66786a9a4c6c9ef1be898e5d)) +* Add support for ExternalDatasetReference ([#2871](https://github.com/googleapis/java-bigquery/issues/2871)) ([bbb86fd](https://github.com/googleapis/java-bigquery/commit/bbb86fd8488ad253f2e9cf3fb08360330bd860a3)) + + +### Dependencies + +* Update actions/checkout action to v4 ([#2862](https://github.com/googleapis/java-bigquery/issues/2862)) ([902e9b9](https://github.com/googleapis/java-bigquery/commit/902e9b97cd548910354297ff6e605df094a03175)) +* Update actions/upload-artifact action to v3.1.3 ([#2867](https://github.com/googleapis/java-bigquery/issues/2867)) ([cbbf0fb](https://github.com/googleapis/java-bigquery/commit/cbbf0fb8a99c0633335d81cd36a7b53dfe9df20b)) +* Update dependency com.google.api.grpc:proto-google-cloud-bigqueryconnection-v1 to v2.26.0 ([#2873](https://github.com/googleapis/java-bigquery/issues/2873)) ([6196625](https://github.com/googleapis/java-bigquery/commit/6196625d614ce80641008ffab3b5bf9720651bb9)) +* Update dependency com.google.cloud:google-cloud-datacatalog-bom to v1.30.0 ([#2874](https://github.com/googleapis/java-bigquery/issues/2874)) ([6cafedf](https://github.com/googleapis/java-bigquery/commit/6cafedf634bc88f41b2b5d3ec1425341b02ac8b6)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.15.0 ([#2870](https://github.com/googleapis/java-bigquery/issues/2870)) ([f24439b](https://github.com/googleapis/java-bigquery/commit/f24439b7adf1f08cee4b65918b4395861fe88517)) +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.26 ([#2868](https://github.com/googleapis/java-bigquery/issues/2868)) ([d01031c](https://github.com/googleapis/java-bigquery/commit/d01031cbc6d50f9aff8c6d49a8d2c54496779451)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.26 ([#2869](https://github.com/googleapis/java-bigquery/issues/2869)) ([edd7141](https://github.com/googleapis/java-bigquery/commit/edd714129b65d73f894591c4d40e1a8e79c36b04)) + ## [2.31.2](https://github.com/googleapis/java-bigquery/compare/v2.31.1...v2.31.2) (2023-09-05) diff --git a/benchmark/pom.xml b/benchmark/pom.xml index 479eecb8a5..7f06c92456 100644 --- a/benchmark/pom.xml +++ b/benchmark/pom.xml @@ -6,7 +6,7 @@ google-cloud-bigquery-parent com.google.cloud - 2.31.3-SNAPSHOT + 2.32.0 diff --git a/google-cloud-bigquery/pom.xml b/google-cloud-bigquery/pom.xml index d1441f1a79..f7fdee1068 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.31.3-SNAPSHOT + 2.32.0 jar BigQuery https://github.com/googleapis/java-bigquery @@ -11,7 +11,7 @@ com.google.cloud google-cloud-bigquery-parent - 2.31.3-SNAPSHOT + 2.32.0 google-cloud-bigquery diff --git a/pom.xml b/pom.xml index 2f90204848..ed6e9d9646 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-bigquery-parent pom - 2.31.3-SNAPSHOT + 2.32.0 BigQuery Parent https://github.com/googleapis/java-bigquery @@ -111,7 +111,7 @@ com.google.cloud google-cloud-bigquery - 2.31.3-SNAPSHOT + 2.32.0 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 5de6ade6f5..f602d39b95 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-bigquery - 2.31.3-SNAPSHOT + 2.32.0 diff --git a/versions.txt b/versions.txt index 49aa7879b5..0b7ba086a6 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-bigquery:2.31.2:2.31.3-SNAPSHOT \ No newline at end of file +google-cloud-bigquery:2.32.0:2.32.0 \ No newline at end of file From 599e3b3d7e948a0688c6e08d4910f9db5c532f99 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 19 Sep 2023 15:46:17 +0200 Subject: [PATCH 20/42] deps: update github/codeql-action action to v2.21.4 (#2829) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * deps: update github/codeql-action action to v2.21.4 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot Co-authored-by: Mridula <66699525+mpeddada1@users.noreply.github.com> --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 4959517d49..f3044fe4ca 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -67,6 +67,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@6ca1aa8c195c3ca3e77c174fe0356db1bce3b319 # v2.21.1 + uses: github/codeql-action/upload-sarif@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4 with: sarif_file: results.sarif From 4a50f38129056da19ed5b0be1ab81ad786a1c276 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 19 Sep 2023 15:47:44 +0200 Subject: [PATCH 21/42] chore(deps): update dependency com.google.cloud:google-cloud-bigtable to v2.27.2 (#2882) --- samples/install-without-bom/pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- samples/snippets/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 0b6b5994bb..d373ea764f 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -63,7 +63,7 @@ com.google.cloud google-cloud-bigtable - 2.26.0 + 2.27.2 test diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index f602d39b95..0952a1d2bf 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -61,7 +61,7 @@ com.google.cloud google-cloud-bigtable - 2.26.0 + 2.27.2 test diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 2e8a7890d2..a37ed03fbe 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -79,7 +79,7 @@ com.google.cloud google-cloud-bigtable - 2.26.0 + 2.27.2 test From 6695f8e79bfd7503cdb991b931a252d57fd42e8a Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 19 Sep 2023 15:48:02 +0200 Subject: [PATCH 22/42] chore(deps): update dependency com.google.cloud:google-cloud-bigquery to v2.32.0 (#2884) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update dependency com.google.cloud:google-cloud-bigquery to v2.32.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- README.md | 8 ++++---- samples/install-without-bom/pom.xml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d5521d9866..3d19e57591 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.31.2 + 2.32.0 ``` @@ -60,13 +60,13 @@ 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.31.2' +implementation 'com.google.cloud:google-cloud-bigquery:2.32.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.31.2" +libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.32.0" ``` @@ -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.31.2 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquery/2.32.0 [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/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index d373ea764f..55b2bfc13c 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.31.2 + 2.32.0 From 2237ca2a1dbe9e1dc1d5e6c0dc2bd2fd39e01ef0 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 19 Sep 2023 15:48:39 +0200 Subject: [PATCH 23/42] deps: update dependency org.graalvm.buildtools:junit-platform-native to v0.9.27 (#2885) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * deps: update dependency org.graalvm.buildtools:junit-platform-native to v0.9.27 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- README.md | 2 +- samples/native-image-sample/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3d19e57591..60649dc7b9 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ 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.22.0') +implementation platform('com.google.cloud:libraries-bom:26.23.0') implementation 'com.google.cloud:google-cloud-bigquery' ``` diff --git a/samples/native-image-sample/pom.xml b/samples/native-image-sample/pom.xml index 7f18e0025f..e5a19a5ee8 100644 --- a/samples/native-image-sample/pom.xml +++ b/samples/native-image-sample/pom.xml @@ -99,7 +99,7 @@ org.graalvm.buildtools junit-platform-native - 0.9.26 + 0.9.27 test From 123ad59b60bbda26c816b5442c3f006cae806932 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 19 Sep 2023 15:48:58 +0200 Subject: [PATCH 24/42] build(deps): update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.6.0 (#2887) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * build(deps): update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.6.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ed6e9d9646..6c00cf8f66 100644 --- a/pom.xml +++ b/pom.xml @@ -224,7 +224,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.5.0 + 3.6.0 html From 86442522401a2b264ca547a6a619588592f954f8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Sep 2023 10:01:47 -0400 Subject: [PATCH 25/42] build(deps): bump cryptography from 41.0.2 to 41.0.3 in /.kokoro (#2835) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * build(deps): bump cryptography from 41.0.2 to 41.0.3 in /.kokoro Bumps [cryptography](https://github.com/pyca/cryptography) from 41.0.2 to 41.0.3. - [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pyca/cryptography/compare/41.0.2...41.0.3) --- updated-dependencies: - dependency-name: cryptography dependency-type: indirect ... Signed-off-by: dependabot[bot] * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Owl Bot Co-authored-by: Mridula <66699525+mpeddada1@users.noreply.github.com> From 7e040e97eeec762ab97190dea33b94769d681bf0 Mon Sep 17 00:00:00 2001 From: Sumit Banerjee <123063931+forksumit@users.noreply.github.com> Date: Thu, 21 Sep 2023 18:38:37 +0530 Subject: [PATCH 26/42] fix: update samples snippet to write to BYTES instead of ARRAY (#2876) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: update snippet to write to BYTES instead of ARRAY * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .../java/com/example/bigquery/InsertingDataTypes.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/samples/snippets/src/main/java/com/example/bigquery/InsertingDataTypes.java b/samples/snippets/src/main/java/com/example/bigquery/InsertingDataTypes.java index 3d721e727d..0f2946488e 100644 --- a/samples/snippets/src/main/java/com/example/bigquery/InsertingDataTypes.java +++ b/samples/snippets/src/main/java/com/example/bigquery/InsertingDataTypes.java @@ -30,6 +30,7 @@ import com.google.cloud.bigquery.TableDefinition; import com.google.cloud.bigquery.TableId; import com.google.cloud.bigquery.TableInfo; +import java.util.Base64; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -53,10 +54,7 @@ public static void insertingDataTypes(String datasetName, String tableName) { // Inserting data types Field name = Field.of("name", StandardSQLTypeName.STRING); Field age = Field.of("age", StandardSQLTypeName.INT64); - Field school = - Field.newBuilder("school", StandardSQLTypeName.BYTES) - .setMode(Field.Mode.REPEATED) - .build(); + Field school = Field.of("school", StandardSQLTypeName.BYTES); Field location = Field.of("location", StandardSQLTypeName.GEOGRAPHY); Field measurements = Field.newBuilder("measurements", StandardSQLTypeName.FLOAT64) @@ -86,7 +84,7 @@ public static void insertingDataTypes(String datasetName, String tableName) { Map rowContent = new HashMap<>(); rowContent.put("name", "Tom"); rowContent.put("age", 30); - rowContent.put("school", "Test University".getBytes()); + rowContent.put("school", Base64.getEncoder().encodeToString("Test University".getBytes())); rowContent.put("location", "POINT(1 2)"); rowContent.put("measurements", new Float[] {50.05f, 100.5f}); rowContent.put("datesTime", datesTimeContent); From 3895bd94b283b6ff731cfa94426ea0691e0d54c4 Mon Sep 17 00:00:00 2001 From: emkornfield Date: Mon, 25 Sep 2023 04:33:52 -0700 Subject: [PATCH 27/42] feat: Add support for FileSetSpec (#2888) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Add support for FileSetSpec * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .../bigquery/ExternalTableDefinition.java | 30 +++++++++++++++++++ .../cloud/bigquery/LoadJobConfiguration.java | 26 ++++++++++++++++ .../bigquery/ExternalTableDefinitionTest.java | 2 ++ .../bigquery/LoadJobConfigurationTest.java | 2 ++ 4 files changed, 60 insertions(+) diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ExternalTableDefinition.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ExternalTableDefinition.java index 18c78e7503..d307b82321 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ExternalTableDefinition.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ExternalTableDefinition.java @@ -79,8 +79,20 @@ public Builder setSourceUris(List sourceUris) { return setSourceUrisImmut(ImmutableList.copyOf(sourceUris)); } + abstract Builder setFileSetSpecTypeInner(String spec); + abstract Builder setSourceUrisImmut(ImmutableList sourceUris); + /** + * Defines how to interpret files denoted by URIs. By default the files are assumed to be data + * files (this can be specified explicitly via FILE_SET_SPEC_TYPE_FILE_SYSTEM_MATCH). A second + * option is "FILE_SET_SPEC_TYPE_NEW_LINE_DELIMITED_MANIFEST" which interprets each file as a + * manifest file, where each line is a reference to a file. + */ + public Builder setFileSetSpecType(String fileSetSpecType) { + return setFileSetSpecTypeInner(fileSetSpecType); + } + /** * Sets the source format, and possibly some parsing options, of the external data. Supported * formats are {@code CSV} and {@code NEWLINE_DELIMITED_JSON}. @@ -232,6 +244,14 @@ public List getSourceUris() { return getSourceUrisImmut(); } + @Nullable + public String getFileSetSpecType() { + return getFileSetSpecTypeInner(); + } + + @Nullable + abstract String getFileSetSpecTypeInner(); + @Nullable public abstract ImmutableList getSourceUrisImmut(); @@ -338,6 +358,10 @@ com.google.api.services.bigquery.model.ExternalDataConfiguration toExternalDataC if (getHivePartitioningOptions() != null) { externalConfigurationPb.setHivePartitioningOptions(getHivePartitioningOptions().toPb()); } + if (getFileSetSpecType() != null) { + externalConfigurationPb.setFileSetSpecType(getFileSetSpecType()); + } + return externalConfigurationPb; } @@ -507,6 +531,9 @@ static ExternalTableDefinition fromPb(Table tablePb) { if (externalDataConfiguration.getReferenceFileSchemaUri() != null) { builder.setReferenceFileSchemaUri(externalDataConfiguration.getReferenceFileSchemaUri()); } + if (externalDataConfiguration.getFileSetSpecType() != null) { + builder.setFileSetSpecType(externalDataConfiguration.getFileSetSpecType()); + } } return builder.build(); } @@ -566,6 +593,9 @@ static ExternalTableDefinition fromExternalDataConfiguration( builder.setHivePartitioningOptions( HivePartitioningOptions.fromPb(externalDataConfiguration.getHivePartitioningOptions())); } + if (externalDataConfiguration.getFileSetSpecType() != null) { + builder.setFileSetSpecType(externalDataConfiguration.getFileSetSpecType()); + } return builder.build(); } diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java index 321d542a67..fefff3409f 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java @@ -38,6 +38,7 @@ public final class LoadJobConfiguration extends JobConfiguration implements Load private static final long serialVersionUID = -2673554846792429829L; private final List sourceUris; + private final String fileSetSpecType; private final TableId destinationTable; private final List decimalTargetTypes; private final EncryptionConfiguration destinationEncryptionConfiguration; @@ -67,6 +68,7 @@ public static final class Builder extends JobConfiguration.Builder sourceUris; + private String fileSetSpecType; private TableId destinationTable; private List decimalTargetTypes; private EncryptionConfiguration destinationEncryptionConfiguration; @@ -107,6 +109,7 @@ private Builder(LoadJobConfiguration loadConfiguration) { this.schema = loadConfiguration.schema; this.ignoreUnknownValues = loadConfiguration.ignoreUnknownValues; this.sourceUris = loadConfiguration.sourceUris; + this.fileSetSpecType = loadConfiguration.fileSetSpecType; this.schemaUpdateOptions = loadConfiguration.schemaUpdateOptions; this.autodetect = loadConfiguration.autodetect; this.destinationEncryptionConfiguration = @@ -175,6 +178,9 @@ private Builder(com.google.api.services.bigquery.model.JobConfiguration configur if (loadConfigurationPb.getSourceUris() != null) { this.sourceUris = ImmutableList.copyOf(configurationPb.getLoad().getSourceUris()); } + if (loadConfigurationPb.getFileSetSpecType() != null) { + this.fileSetSpecType = loadConfigurationPb.getFileSetSpecType(); + } if (loadConfigurationPb.getSchemaUpdateOptions() != null) { ImmutableList.Builder schemaUpdateOptionsBuilder = new ImmutableList.Builder<>(); @@ -306,6 +312,17 @@ public Builder setSourceUris(List sourceUris) { return this; } + /** + * Defines how to interpret files denoted by URIs. By default the files are assumed to be data + * files (this can be specified explicitly via FILE_SET_SPEC_TYPE_FILE_SYSTEM_MATCH). A second + * option is "FILE_SET_SPEC_TYPE_NEW_LINE_DELIMITED_MANIFEST" which interprets each file as a + * manifest file, where each line is a reference to a file. + */ + public Builder setFileSetSpecType(String fileSetSpecType) { + this.fileSetSpecType = fileSetSpecType; + return this; + } + /** * Defines the list of possible SQL data types to which the source decimal values are converted. * This list and the precision and the scale parameters of the decimal field determine the @@ -403,6 +420,7 @@ public LoadJobConfiguration build() { private LoadJobConfiguration(Builder builder) { super(builder); this.sourceUris = builder.sourceUris; + this.fileSetSpecType = builder.fileSetSpecType; this.destinationTable = builder.destinationTable; this.decimalTargetTypes = builder.decimalTargetTypes; this.createDisposition = builder.createDisposition; @@ -497,6 +515,10 @@ public List getSourceUris() { return sourceUris; } + public String getFileSetSpecType() { + return fileSetSpecType; + } + public List getDecimalTargetTypes() { return decimalTargetTypes; } @@ -575,6 +597,7 @@ ToStringHelper toStringHelper() { .add("schema", schema) .add("ignoreUnknownValue", ignoreUnknownValues) .add("sourceUris", sourceUris) + .add("fileSetSpecType", fileSetSpecType) .add("schemaUpdateOptions", schemaUpdateOptions) .add("autodetect", autodetect) .add("timePartitioning", timePartitioning) @@ -655,6 +678,9 @@ com.google.api.services.bigquery.model.JobConfiguration toPb() { if (sourceUris != null) { loadConfigurationPb.setSourceUris(ImmutableList.copyOf(sourceUris)); } + if (fileSetSpecType != null) { + loadConfigurationPb.setFileSetSpecType(fileSetSpecType); + } if (decimalTargetTypes != null) { loadConfigurationPb.setDecimalTargetTypes(ImmutableList.copyOf(decimalTargetTypes)); } diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/ExternalTableDefinitionTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/ExternalTableDefinitionTest.java index 4a74091620..3e67ad9599 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/ExternalTableDefinitionTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/ExternalTableDefinitionTest.java @@ -60,6 +60,7 @@ public class ExternalTableDefinitionTest { .build(); private static final ExternalTableDefinition EXTERNAL_TABLE_DEFINITION = ExternalTableDefinition.newBuilder(SOURCE_URIS, TABLE_SCHEMA, CSV_OPTIONS) + .setFileSetSpecType("FILE_SET_SPEC_TYPE_FILE_SYSTEM_MATCH") .setDecimalTargetTypes(DECIMAL_TARGET_TYPES) .setCompression(COMPRESSION) .setConnectionId(CONNECTION_ID) @@ -154,6 +155,7 @@ public void testToAndFromPbParquet() { private void compareExternalTableDefinition( ExternalTableDefinition expected, ExternalTableDefinition value) { assertEquals(expected, value); + assertEquals(expected.getFileSetSpecType(), value.getFileSetSpecType()); assertEquals(expected.getDecimalTargetTypes(), value.getDecimalTargetTypes()); assertEquals(expected.getCompression(), value.getCompression()); assertEquals(expected.getConnectionId(), value.getConnectionId()); diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/LoadJobConfigurationTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/LoadJobConfigurationTest.java index 341965fb80..563a3f34a1 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/LoadJobConfigurationTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/LoadJobConfigurationTest.java @@ -91,6 +91,7 @@ public class LoadJobConfigurationTest { .setCreateDisposition(CREATE_DISPOSITION) .setWriteDisposition(WRITE_DISPOSITION) .setFormatOptions(CSV_OPTIONS) + .setFileSetSpecType("FILE_SET_SPEC_TYPE_FILE_SYSTEM_MATCH") .setIgnoreUnknownValues(IGNORE_UNKNOWN_VALUES) .setMaxBadRecords(MAX_BAD_RECORDS) .setSchema(TABLE_SCHEMA) @@ -240,6 +241,7 @@ private void compareLoadJobConfiguration( LoadJobConfiguration expected, LoadJobConfiguration value) { assertEquals(expected, value); assertEquals(expected.hashCode(), value.hashCode()); + assertEquals(expected.getFileSetSpecType(), value.getFileSetSpecType()); assertEquals(expected.toString(), value.toString()); assertEquals(expected.getDestinationTable(), value.getDestinationTable()); assertEquals(expected.getDecimalTargetTypes(), value.getDecimalTargetTypes()); From 8c68dbe507406b134e1ff300d819f46836595c13 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 26 Sep 2023 21:50:27 +0200 Subject: [PATCH 28/42] test(deps): update dependency com.google.cloud:google-cloud-storage to v2.27.1 (#2896) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6c00cf8f66..092adfe77f 100644 --- a/pom.xml +++ b/pom.xml @@ -155,7 +155,7 @@ com.google.cloud google-cloud-storage - 2.27.0 + 2.27.1 test From 487c310b251000006a782cf331b73f33b7f5d2a1 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 26 Sep 2023 21:50:41 +0200 Subject: [PATCH 29/42] build(deps): update dependency org.apache.maven.plugins:maven-shade-plugin to v3.5.1 (#2894) --- benchmark/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/pom.xml b/benchmark/pom.xml index 7f06c92456..16888be6ef 100644 --- a/benchmark/pom.xml +++ b/benchmark/pom.xml @@ -42,7 +42,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.5.0 + 3.5.1 package From 539b4e62f80598fb510fad37429ae0441db04c6f Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 26 Sep 2023 21:53:39 +0200 Subject: [PATCH 30/42] deps: update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.27 (#2886) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * deps: update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.27 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- samples/native-image-sample/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/native-image-sample/pom.xml b/samples/native-image-sample/pom.xml index e5a19a5ee8..1f18d2c067 100644 --- a/samples/native-image-sample/pom.xml +++ b/samples/native-image-sample/pom.xml @@ -121,7 +121,7 @@ org.graalvm.buildtools native-maven-plugin - 0.9.26 + 0.9.27 true com.example.bigquery.NativeImageBigquerySample From b568026fe1b8fb7365306b718b5f8540fb13b8dc Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 26 Sep 2023 21:53:46 +0200 Subject: [PATCH 31/42] deps: update github/codeql-action action to v2.21.8 (#2889) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * deps: update github/codeql-action action to v2.21.8 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index f3044fe4ca..19fbe5ba1a 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -67,6 +67,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4 + uses: github/codeql-action/upload-sarif@6a28655e3dcb49cb0840ea372fd6d17733edd8a4 # v2.21.8 with: sarif_file: results.sarif From e1d987199ad8994aa3e9115daf26e0fb27aef911 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 27 Sep 2023 03:11:10 +0200 Subject: [PATCH 32/42] deps: update dependency com.google.cloud:google-cloud-shared-dependencies to v3.16.1 (#2892) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 092adfe77f..0afbe66523 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,7 @@ github google-cloud-bigquery-parent v2-rev20230812-2.0.0 - 3.15.0 + 3.16.1 12.0.1 From 43a1345f3288ffbf7435a93a91537a06a6381595 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 27 Sep 2023 11:51:35 -0400 Subject: [PATCH 33/42] chore(main): release 2.32.1-SNAPSHOT (#2883) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- benchmark/pom.xml | 2 +- google-cloud-bigquery/pom.xml | 4 ++-- pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/benchmark/pom.xml b/benchmark/pom.xml index 16888be6ef..adb3df32ab 100644 --- a/benchmark/pom.xml +++ b/benchmark/pom.xml @@ -6,7 +6,7 @@ google-cloud-bigquery-parent com.google.cloud - 2.32.0 + 2.32.1-SNAPSHOT diff --git a/google-cloud-bigquery/pom.xml b/google-cloud-bigquery/pom.xml index f7fdee1068..e8857bfc4a 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.32.0 + 2.32.1-SNAPSHOT jar BigQuery https://github.com/googleapis/java-bigquery @@ -11,7 +11,7 @@ com.google.cloud google-cloud-bigquery-parent - 2.32.0 + 2.32.1-SNAPSHOT google-cloud-bigquery diff --git a/pom.xml b/pom.xml index 0afbe66523..40abac928d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-bigquery-parent pom - 2.32.0 + 2.32.1-SNAPSHOT BigQuery Parent https://github.com/googleapis/java-bigquery @@ -111,7 +111,7 @@ com.google.cloud google-cloud-bigquery - 2.32.0 + 2.32.1-SNAPSHOT diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 0952a1d2bf..0a0005d9c3 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-bigquery - 2.32.0 + 2.32.1-SNAPSHOT diff --git a/versions.txt b/versions.txt index 0b7ba086a6..9301fb640b 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-bigquery:2.32.0:2.32.0 \ No newline at end of file +google-cloud-bigquery:2.32.0:2.32.1-SNAPSHOT \ No newline at end of file From e3655af235f002128979ed592c5aade33a4c7596 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 27 Sep 2023 22:37:07 +0200 Subject: [PATCH 34/42] deps: update actions/checkout action (#2893) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * deps: update actions/checkout action * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 19fbe5ba1a..418aff4829 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -32,7 +32,7 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 with: persist-credentials: false From ab4e1d026c34b7d28caaf5b0b1465ac2de62c530 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 27 Sep 2023 22:37:19 +0200 Subject: [PATCH 35/42] deps: update github/codeql-action action to v2.21.8 - abandoned (#2897) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * deps: update github/codeql-action action to v2.21.8 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot From 33a729f367ba6d9f04595e1b781c7eb321289380 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 27 Sep 2023 22:56:22 +0200 Subject: [PATCH 36/42] deps: update github/codeql-action action to v2.21.9 (#2901) --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 418aff4829..32d3cc29b8 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -67,6 +67,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@6a28655e3dcb49cb0840ea372fd6d17733edd8a4 # v2.21.8 + uses: github/codeql-action/upload-sarif@ddccb873888234080b77e9bc2d4764d5ccaaccf9 # v2.21.9 with: sarif_file: results.sarif From 682460580d0e50c4c7993ceef7daac93b49880f7 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 27 Sep 2023 17:37:27 -0400 Subject: [PATCH 37/42] chore(main): release 2.33.0 (#2900) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 24 ++++++++++++++++++++++++ benchmark/pom.xml | 2 +- google-cloud-bigquery/pom.xml | 4 ++-- pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 2 +- 6 files changed, 31 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05a148540f..94c2f34ac9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # Changelog +## [2.33.0](https://github.com/googleapis/java-bigquery/compare/v2.32.0...v2.33.0) (2023-09-27) + + +### Features + +* Add support for FileSetSpec ([#2888](https://github.com/googleapis/java-bigquery/issues/2888)) ([3895bd9](https://github.com/googleapis/java-bigquery/commit/3895bd94b283b6ff731cfa94426ea0691e0d54c4)) + + +### Bug Fixes + +* Update samples snippet to write to BYTES instead of ARRAY<BYTES> ([#2876](https://github.com/googleapis/java-bigquery/issues/2876)) ([7e040e9](https://github.com/googleapis/java-bigquery/commit/7e040e97eeec762ab97190dea33b94769d681bf0)) + + +### Dependencies + +* Update actions/checkout action ([#2893](https://github.com/googleapis/java-bigquery/issues/2893)) ([e3655af](https://github.com/googleapis/java-bigquery/commit/e3655af235f002128979ed592c5aade33a4c7596)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.16.1 ([#2892](https://github.com/googleapis/java-bigquery/issues/2892)) ([e1d9871](https://github.com/googleapis/java-bigquery/commit/e1d987199ad8994aa3e9115daf26e0fb27aef911)) +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.27 ([#2885](https://github.com/googleapis/java-bigquery/issues/2885)) ([2237ca2](https://github.com/googleapis/java-bigquery/commit/2237ca2a1dbe9e1dc1d5e6c0dc2bd2fd39e01ef0)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.27 ([#2886](https://github.com/googleapis/java-bigquery/issues/2886)) ([539b4e6](https://github.com/googleapis/java-bigquery/commit/539b4e62f80598fb510fad37429ae0441db04c6f)) +* Update github/codeql-action action to v2.21.4 ([#2829](https://github.com/googleapis/java-bigquery/issues/2829)) ([599e3b3](https://github.com/googleapis/java-bigquery/commit/599e3b3d7e948a0688c6e08d4910f9db5c532f99)) +* Update github/codeql-action action to v2.21.8 - abandoned ([#2897](https://github.com/googleapis/java-bigquery/issues/2897)) ([ab4e1d0](https://github.com/googleapis/java-bigquery/commit/ab4e1d026c34b7d28caaf5b0b1465ac2de62c530)) +* Update github/codeql-action action to v2.21.8 ([#2889](https://github.com/googleapis/java-bigquery/issues/2889)) ([b568026](https://github.com/googleapis/java-bigquery/commit/b568026fe1b8fb7365306b718b5f8540fb13b8dc)) +* Update github/codeql-action action to v2.21.9 ([#2901](https://github.com/googleapis/java-bigquery/issues/2901)) ([33a729f](https://github.com/googleapis/java-bigquery/commit/33a729f367ba6d9f04595e1b781c7eb321289380)) + ## [2.32.0](https://github.com/googleapis/java-bigquery/compare/v2.31.2...v2.32.0) (2023-09-14) diff --git a/benchmark/pom.xml b/benchmark/pom.xml index adb3df32ab..5c3a2a7652 100644 --- a/benchmark/pom.xml +++ b/benchmark/pom.xml @@ -6,7 +6,7 @@ google-cloud-bigquery-parent com.google.cloud - 2.32.1-SNAPSHOT + 2.33.0 diff --git a/google-cloud-bigquery/pom.xml b/google-cloud-bigquery/pom.xml index e8857bfc4a..8e836b6f39 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.32.1-SNAPSHOT + 2.33.0 jar BigQuery https://github.com/googleapis/java-bigquery @@ -11,7 +11,7 @@ com.google.cloud google-cloud-bigquery-parent - 2.32.1-SNAPSHOT + 2.33.0 google-cloud-bigquery diff --git a/pom.xml b/pom.xml index 40abac928d..13123299df 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-bigquery-parent pom - 2.32.1-SNAPSHOT + 2.33.0 BigQuery Parent https://github.com/googleapis/java-bigquery @@ -111,7 +111,7 @@ com.google.cloud google-cloud-bigquery - 2.32.1-SNAPSHOT + 2.33.0 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 0a0005d9c3..7f01cd52ec 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-bigquery - 2.32.1-SNAPSHOT + 2.33.0 diff --git a/versions.txt b/versions.txt index 9301fb640b..139a314858 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-bigquery:2.32.0:2.32.1-SNAPSHOT \ No newline at end of file +google-cloud-bigquery:2.33.0:2.33.0 \ No newline at end of file From 8f85a4d540623e8b4c83005e62e842ba36f8fb1b Mon Sep 17 00:00:00 2001 From: Obada Alabbadi <76101898+obada-ab@users.noreply.github.com> Date: Thu, 28 Sep 2023 10:18:14 +0200 Subject: [PATCH 38/42] fix: dry run NPE when there is no query parameters (#2899) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 #2895 ☕️ --- .../google/cloud/bigquery/ConnectionImpl.java | 5 +++- .../cloud/bigquery/ConnectionImplTest.java | 28 +++++++++++++++++++ .../cloud/bigquery/it/ITBigQueryTest.java | 28 +++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ConnectionImpl.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ConnectionImpl.java index 17a459312b..2d0367790e 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ConnectionImpl.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ConnectionImpl.java @@ -55,6 +55,7 @@ import java.io.IOException; import java.util.AbstractList; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -173,7 +174,9 @@ public BigQueryDryRunResult dryRun(String sql) throws BigQuerySQLException { List queryParametersPb = dryRunJob.getStatistics().getQuery().getUndeclaredQueryParameters(); List queryParameters = - Lists.transform(queryParametersPb, QUERY_PARAMETER_FROM_PB_FUNCTION); + queryParametersPb == null + ? Collections.emptyList() + : Lists.transform(queryParametersPb, QUERY_PARAMETER_FROM_PB_FUNCTION); QueryStatistics queryStatistics = JobStatistics.fromPb(dryRunJob); SessionInfo sessionInfo = queryStatistics.getSessionInfo() == null ? null : queryStatistics.getSessionInfo(); diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/ConnectionImplTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/ConnectionImplTest.java index d6348f053e..dff73d6bdf 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/ConnectionImplTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/ConnectionImplTest.java @@ -237,6 +237,34 @@ public void testQueryDryRun() throws BigQuerySQLException { .createJobForQuery(any(com.google.api.services.bigquery.model.Job.class)); } + @Test + public void testQueryDryRunNoQueryParameters() throws BigQuerySQLException { + com.google.api.services.bigquery.model.JobStatistics2 queryMock = + new com.google.api.services.bigquery.model.JobStatistics2() + .setSchema(FAST_QUERY_TABLESCHEMA); + com.google.api.services.bigquery.model.JobStatistics jobStatsMock = + new com.google.api.services.bigquery.model.JobStatistics() + .setCreationTime(1234L) + .setStartTime(5678L) + .setQuery(queryMock); + com.google.api.services.bigquery.model.JobConfigurationQuery jobConfigurationQuery = + new com.google.api.services.bigquery.model.JobConfigurationQuery(); + com.google.api.services.bigquery.model.JobConfiguration jobConfig = + new com.google.api.services.bigquery.model.JobConfiguration() + .setQuery(jobConfigurationQuery); + com.google.api.services.bigquery.model.Job mockDryRunJob = + new com.google.api.services.bigquery.model.Job() + .setStatistics(jobStatsMock) + .setConfiguration(jobConfig); + when(bigqueryRpcMock.createJobForQuery(any(com.google.api.services.bigquery.model.Job.class))) + .thenReturn(mockDryRunJob); + BigQueryDryRunResult dryRunResult = connection.dryRun(DRY_RUN_SQL); + assertEquals(0, dryRunResult.getQueryParameters().size()); + assertEquals(QUERY_SCHEMA, dryRunResult.getSchema()); + verify(bigqueryRpcMock, times(1)) + .createJobForQuery(any(com.google.api.services.bigquery.model.Job.class)); + } + @Test public void testParseDataTask() throws InterruptedException { BlockingQueue, Boolean>> pageCache = 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 cf180f9a36..549066c5fc 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 @@ -2989,6 +2989,34 @@ public void testConnectionImplDryRun() throws SQLException { assertEquals(StatementType.SELECT, queryStatistics.getStatementType()); } + @Test + public void testConnectionImplDryRunNoQueryParameters() throws SQLException { + String query = + String.format( + "select StringField, BigNumericField, BooleanField, BytesField, IntegerField, " + + "TimestampField, FloatField, NumericField, TimeField, DateField, DateTimeField, " + + "GeographyField, RecordField.BytesField, RecordField.BooleanField, " + + "IntegerArrayField from %s order by TimestampField", + TABLE_ID_FASTQUERY_BQ_RESULTSET.getTable()); + ConnectionSettings connectionSettings = + ConnectionSettings.newBuilder() + .setDefaultDataset(DatasetId.of(DATASET)) + .setCreateSession(true) + .build(); + Connection connection = bigquery.createConnection(connectionSettings); + BigQueryDryRunResult bigQueryDryRunResultSet = connection.dryRun(query); + assertNotNull(bigQueryDryRunResultSet.getSchema()); + assertEquals( + BQ_RESULTSET_EXPECTED_SCHEMA, bigQueryDryRunResultSet.getSchema()); // match the schema + List queryParameters = bigQueryDryRunResultSet.getQueryParameters(); + assertEquals(0, queryParameters.size()); + QueryStatistics queryStatistics = bigQueryDryRunResultSet.getStatistics().getQueryStatistics(); + assertNotNull(queryStatistics); + SessionInfo sessionInfo = bigQueryDryRunResultSet.getStatistics().getSessionInfo(); + assertNotNull(sessionInfo.getSessionId()); + assertEquals(StatementType.SELECT, queryStatistics.getStatementType()); + } + @Test // This test case test the order of the records, making sure that the result is not jumbled up due // to the multithreaded BigQueryResult implementation From b0a3311a85132f077f183251c3ad4f1205fb2fb3 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 28 Sep 2023 14:28:18 -0400 Subject: [PATCH 39/42] chore(main): release 2.33.1-SNAPSHOT (#2902) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 2.33.1-SNAPSHOT * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- README.md | 6 +++--- benchmark/pom.xml | 2 +- google-cloud-bigquery/pom.xml | 4 ++-- pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 60649dc7b9..e7eb451e71 100644 --- a/README.md +++ b/README.md @@ -60,13 +60,13 @@ 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.32.0' +implementation 'com.google.cloud:google-cloud-bigquery:2.33.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.32.0" +libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.33.0" ``` @@ -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.32.0 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquery/2.33.0 [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 5c3a2a7652..9ba91158f5 100644 --- a/benchmark/pom.xml +++ b/benchmark/pom.xml @@ -6,7 +6,7 @@ google-cloud-bigquery-parent com.google.cloud - 2.33.0 + 2.33.1-SNAPSHOT diff --git a/google-cloud-bigquery/pom.xml b/google-cloud-bigquery/pom.xml index 8e836b6f39..64ca9d2230 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.33.0 + 2.33.1-SNAPSHOT jar BigQuery https://github.com/googleapis/java-bigquery @@ -11,7 +11,7 @@ com.google.cloud google-cloud-bigquery-parent - 2.33.0 + 2.33.1-SNAPSHOT google-cloud-bigquery diff --git a/pom.xml b/pom.xml index 13123299df..047ad0cdb5 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-bigquery-parent pom - 2.33.0 + 2.33.1-SNAPSHOT BigQuery Parent https://github.com/googleapis/java-bigquery @@ -111,7 +111,7 @@ com.google.cloud google-cloud-bigquery - 2.33.0 + 2.33.1-SNAPSHOT diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 7f01cd52ec..e0363b69e5 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-bigquery - 2.33.0 + 2.33.1-SNAPSHOT diff --git a/versions.txt b/versions.txt index 139a314858..d9423a3ac3 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-bigquery:2.33.0:2.33.0 \ No newline at end of file +google-cloud-bigquery:2.33.0:2.33.1-SNAPSHOT \ No newline at end of file From 0ab89134897bed696d50e22aebc2f651684ff999 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 28 Sep 2023 21:06:34 +0200 Subject: [PATCH 40/42] chore(deps): update dependency com.google.cloud:google-cloud-bigquerystorage-bom to v2.43.0 (#2906) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 047ad0cdb5..3d53134995 100644 --- a/pom.xml +++ b/pom.xml @@ -73,7 +73,7 @@ com.google.cloud google-cloud-bigquerystorage-bom - 2.42.0 + 2.43.0 pom import From b81202b3bc4d53b2ef57edb0f9b9f3b9318c8871 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 28 Sep 2023 21:06:59 +0200 Subject: [PATCH 41/42] chore(deps): update dependency com.google.cloud:google-cloud-bigquery to v2.33.0 (#2903) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update dependency com.google.cloud:google-cloud-bigquery to v2.33.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- README.md | 2 +- samples/install-without-bom/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e7eb451e71..80b1ce1a99 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.32.0 + 2.33.0 ``` diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 55b2bfc13c..65f4ca9618 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.32.0 + 2.33.0 From 91b83db5343d757cc02e1958b6028c14cfd72e52 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 28 Sep 2023 15:45:44 -0400 Subject: [PATCH 42/42] chore(main): release 2.33.1 (#2907) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ benchmark/pom.xml | 2 +- google-cloud-bigquery/pom.xml | 4 ++-- pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 2 +- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94c2f34ac9..732bdec1ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [2.33.1](https://github.com/googleapis/java-bigquery/compare/v2.33.0...v2.33.1) (2023-09-28) + + +### Bug Fixes + +* Dry run NPE when there is no query parameters ([#2899](https://github.com/googleapis/java-bigquery/issues/2899)) ([8f85a4d](https://github.com/googleapis/java-bigquery/commit/8f85a4d540623e8b4c83005e62e842ba36f8fb1b)) + ## [2.33.0](https://github.com/googleapis/java-bigquery/compare/v2.32.0...v2.33.0) (2023-09-27) diff --git a/benchmark/pom.xml b/benchmark/pom.xml index 9ba91158f5..cef22f9b9f 100644 --- a/benchmark/pom.xml +++ b/benchmark/pom.xml @@ -6,7 +6,7 @@ google-cloud-bigquery-parent com.google.cloud - 2.33.1-SNAPSHOT + 2.33.1 diff --git a/google-cloud-bigquery/pom.xml b/google-cloud-bigquery/pom.xml index 64ca9d2230..f2d3a307a3 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.33.1-SNAPSHOT + 2.33.1 jar BigQuery https://github.com/googleapis/java-bigquery @@ -11,7 +11,7 @@ com.google.cloud google-cloud-bigquery-parent - 2.33.1-SNAPSHOT + 2.33.1 google-cloud-bigquery diff --git a/pom.xml b/pom.xml index 3d53134995..fedd467c05 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-bigquery-parent pom - 2.33.1-SNAPSHOT + 2.33.1 BigQuery Parent https://github.com/googleapis/java-bigquery @@ -111,7 +111,7 @@ com.google.cloud google-cloud-bigquery - 2.33.1-SNAPSHOT + 2.33.1 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index e0363b69e5..dae7336105 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-bigquery - 2.33.1-SNAPSHOT + 2.33.1 diff --git a/versions.txt b/versions.txt index d9423a3ac3..ec7dfb0ad5 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-bigquery:2.33.0:2.33.1-SNAPSHOT \ No newline at end of file +google-cloud-bigquery:2.33.1:2.33.1 \ No newline at end of file