This is an automated email from the ASF dual-hosted git repository.
yhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 8da478be0d7 switch from v19 to v23 (#37620)
8da478be0d7 is described below
commit 8da478be0d7eab915eb06cf6f92ea6b782dd2526
Author: Derrick Williams <[email protected]>
AuthorDate: Tue Feb 17 10:54:37 2026 -0500
switch from v19 to v23 (#37620)
---
sdks/java/io/google-ads/build.gradle | 4 +-
.../apache/beam/sdk/io/googleads/GoogleAdsIO.java | 6 +--
.../{GoogleAdsV19.java => GoogleAdsV23.java} | 56 +++++++++++-----------
.../sdk/io/googleads/DummyRateLimitPolicy.java | 4 +-
.../beam/sdk/io/googleads/GoogleAdsIOTest.java | 40 ++++++++--------
.../io/googleads/MockGoogleAdsClientFactory.java | 10 ++--
6 files changed, 60 insertions(+), 60 deletions(-)
diff --git a/sdks/java/io/google-ads/build.gradle
b/sdks/java/io/google-ads/build.gradle
index 0796c412a65..84388d5b7a1 100644
--- a/sdks/java/io/google-ads/build.gradle
+++ b/sdks/java/io/google-ads/build.gradle
@@ -33,8 +33,8 @@ dependencies {
implementation library.java.google_auth_library_oauth2_http
implementation library.java.protobuf_java
implementation library.java.protobuf_java_util
- implementation "com.google.api-ads:google-ads:36.0.0"
- implementation "com.google.api-ads:google-ads-stubs-v19:36.0.0"
+ implementation "com.google.api-ads:google-ads:42.0.0"
+ implementation "com.google.api-ads:google-ads-stubs-v23:42.0.0"
implementation library.java.joda_time
implementation library.java.vendored_guava_32_1_2_jre
testImplementation project(path: ":sdks:java:core", configuration:
"shadowTest")
diff --git
a/sdks/java/io/google-ads/src/main/java/org/apache/beam/sdk/io/googleads/GoogleAdsIO.java
b/sdks/java/io/google-ads/src/main/java/org/apache/beam/sdk/io/googleads/GoogleAdsIO.java
index d90c7751e6b..04d6155a428 100644
---
a/sdks/java/io/google-ads/src/main/java/org/apache/beam/sdk/io/googleads/GoogleAdsIO.java
+++
b/sdks/java/io/google-ads/src/main/java/org/apache/beam/sdk/io/googleads/GoogleAdsIO.java
@@ -28,7 +28,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
* href="https://developers.google.com/google-ads/api/docs/start">Google Ads
API</a> over supported
* versions of the Google Ads client libraries.
*
- * @see GoogleAdsV19
+ * @see GoogleAdsV23
*/
public abstract class GoogleAdsIO<GoogleAdsRowT,
SearchGoogleAdsStreamRequestT> {
@@ -45,8 +45,8 @@ public abstract class GoogleAdsIO<GoogleAdsRowT,
SearchGoogleAdsStreamRequestT>
PTransform<PCollection<SearchGoogleAdsStreamRequestT>,
PCollection<GoogleAdsRowT>>>
T readAll();
- public static GoogleAdsV19 current() {
- return GoogleAdsV19.INSTANCE;
+ public static GoogleAdsV23 current() {
+ return GoogleAdsV23.INSTANCE;
}
/**
diff --git
a/sdks/java/io/google-ads/src/main/java/org/apache/beam/sdk/io/googleads/GoogleAdsV19.java
b/sdks/java/io/google-ads/src/main/java/org/apache/beam/sdk/io/googleads/GoogleAdsV23.java
similarity index 93%
rename from
sdks/java/io/google-ads/src/main/java/org/apache/beam/sdk/io/googleads/GoogleAdsV19.java
rename to
sdks/java/io/google-ads/src/main/java/org/apache/beam/sdk/io/googleads/GoogleAdsV23.java
index 11f11ea5f8c..f8f26d8965d 100644
---
a/sdks/java/io/google-ads/src/main/java/org/apache/beam/sdk/io/googleads/GoogleAdsV19.java
+++
b/sdks/java/io/google-ads/src/main/java/org/apache/beam/sdk/io/googleads/GoogleAdsV23.java
@@ -22,15 +22,15 @@ import static
org.apache.beam.sdk.util.Preconditions.checkStateNotNull;
import static
org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.base.Preconditions.checkArgument;
import com.google.ads.googleads.lib.GoogleAdsClient;
-import com.google.ads.googleads.v19.errors.GoogleAdsError;
-import com.google.ads.googleads.v19.errors.GoogleAdsException;
-import com.google.ads.googleads.v19.errors.GoogleAdsFailure;
-import com.google.ads.googleads.v19.errors.InternalErrorEnum;
-import com.google.ads.googleads.v19.errors.QuotaErrorEnum;
-import com.google.ads.googleads.v19.services.GoogleAdsRow;
-import com.google.ads.googleads.v19.services.GoogleAdsServiceClient;
-import com.google.ads.googleads.v19.services.SearchGoogleAdsStreamRequest;
-import com.google.ads.googleads.v19.services.SearchGoogleAdsStreamResponse;
+import com.google.ads.googleads.v23.errors.GoogleAdsError;
+import com.google.ads.googleads.v23.errors.GoogleAdsException;
+import com.google.ads.googleads.v23.errors.GoogleAdsFailure;
+import com.google.ads.googleads.v23.errors.InternalErrorEnum;
+import com.google.ads.googleads.v23.errors.QuotaErrorEnum;
+import com.google.ads.googleads.v23.services.GoogleAdsRow;
+import com.google.ads.googleads.v23.services.GoogleAdsServiceClient;
+import com.google.ads.googleads.v23.services.SearchGoogleAdsStreamRequest;
+import com.google.ads.googleads.v23.services.SearchGoogleAdsStreamResponse;
import com.google.auto.value.AutoValue;
import com.google.protobuf.Message;
import com.google.protobuf.util.Durations;
@@ -57,7 +57,7 @@ import
org.checkerframework.checker.nullness.qual.RequiresNonNull;
import org.joda.time.Duration;
/**
- * {@link GoogleAdsV19} provides an API to read Google Ads API v19 reports.
+ * {@link GoogleAdsV23} provides an API to read Google Ads API v23 reports.
*
* <p>No backward compatibility guaranteed. Do not use directly. Use {@link
GoogleAdsIO#current()}
* to access GoogleAdsIO instead.
@@ -79,15 +79,15 @@ import org.joda.time.Duration;
* --googleAdsDeveloperToken=your-developer-token
* </pre>
*
- * <p>Use {@link GoogleAdsV19#read()} to read either a bounded or unbounded
{@link PCollection} of
+ * <p>Use {@link GoogleAdsV23#read()} to read either a bounded or unbounded
{@link PCollection} of
* {@link GoogleAdsRow} from a single <a
*
href="https://developers.google.com/google-ads/api/docs/query/overview">Google
Ads Query
* Language</a> query using {@link Read#withQuery(String)} and a {@link
PCollection} of customer
- * IDs. Alternatively, use {@link GoogleAdsV19#readAll()} to read either a
bounded or unbounded
+ * IDs. Alternatively, use {@link GoogleAdsV23#readAll()} to read either a
bounded or unbounded
* {@link PCollection} of {@link GoogleAdsRow} from a {@link PCollection} of
{@link
* SearchGoogleAdsStreamRequest} potentially containing many different queries.
*
- * <p>For example, using {@link GoogleAdsV19#read()}:
+ * <p>For example, using {@link GoogleAdsV23#read()}:
*
* <pre>{@code
* Pipeline p = Pipeline.create();
@@ -107,7 +107,7 @@ import org.joda.time.Duration;
* p.run();
* }</pre>
*
- * <p>Alternatively, using {@link GoogleAdsV19#readAll()} to execute requests
from a {@link
+ * <p>Alternatively, using {@link GoogleAdsV23#readAll()} to execute requests
from a {@link
* PCollection} of {@link SearchGoogleAdsStreamRequest}:
*
* <pre>{@code
@@ -132,7 +132,7 @@ import org.joda.time.Duration;
*
* <h2>Client-side rate limiting</h2>
*
- * On construction of a {@link GoogleAdsV19#read()} or {@link
GoogleAdsV19#readAll()} transform a
+ * On construction of a {@link GoogleAdsV23#read()} or {@link
GoogleAdsV23#readAll()} transform a
* rate limiting policy must be specified to stay well under the assigned
quota for the Google Ads
* API. The Google Ads API enforces global rate limits from the developer
token down to the customer
* ID and depending on the access level of the developer token a limit on the
total number of
@@ -161,21 +161,21 @@ import org.joda.time.Duration;
* @see <a
href="https://developers.google.com/google-ads/api/docs/best-practices/overview">Best
* Practices in the Google Ads documentation</a>
*/
-public class GoogleAdsV19 extends GoogleAdsIO<GoogleAdsRow,
SearchGoogleAdsStreamRequest> {
- static final GoogleAdsV19 INSTANCE = new GoogleAdsV19();
+public class GoogleAdsV23 extends GoogleAdsIO<GoogleAdsRow,
SearchGoogleAdsStreamRequest> {
+ static final GoogleAdsV23 INSTANCE = new GoogleAdsV23();
- private GoogleAdsV19() {}
+ private GoogleAdsV23() {}
@Override
public Read read() {
- return new AutoValue_GoogleAdsV19_Read.Builder()
+ return new AutoValue_GoogleAdsV23_Read.Builder()
.setGoogleAdsClientFactory(DefaultGoogleAdsClientFactory.getInstance())
.build();
}
@Override
public ReadAll readAll() {
- return new AutoValue_GoogleAdsV19_ReadAll.Builder()
+ return new AutoValue_GoogleAdsV23_ReadAll.Builder()
.setGoogleAdsClientFactory(DefaultGoogleAdsClientFactory.getInstance())
.build();
}
@@ -450,13 +450,13 @@ public class GoogleAdsV19 extends
GoogleAdsIO<GoogleAdsRow, SearchGoogleAdsStrea
@VisibleForTesting static Sleeper sleeper = Sleeper.DEFAULT;
- private final GoogleAdsV19.ReadAll spec;
+ private final GoogleAdsV23.ReadAll spec;
private transient @Nullable GoogleAdsClient googleAdsClient;
private transient @Nullable GoogleAdsServiceClient
googleAdsServiceClient;
private transient @Nullable RateLimitPolicy<GoogleAdsError>
rateLimitPolicy;
- ReadAllFn(GoogleAdsV19.ReadAll spec) {
+ ReadAllFn(GoogleAdsV23.ReadAll spec) {
this.spec = spec;
}
@@ -470,7 +470,7 @@ public class GoogleAdsV19 extends GoogleAdsIO<GoogleAdsRow,
SearchGoogleAdsStrea
.newGoogleAdsClient(
adsOptions, spec.getDeveloperToken(), null,
spec.getLoginCustomerId());
final GoogleAdsServiceClient googleAdsServiceClient =
- googleAdsClient.getVersion19().createGoogleAdsServiceClient();
+ googleAdsClient.getVersion23().createGoogleAdsServiceClient();
final RateLimitPolicy<GoogleAdsError> rateLimitPolicy =
checkStateNotNull(spec.getRateLimitPolicyFactory()).getRateLimitPolicy();
@@ -578,17 +578,17 @@ public class GoogleAdsV19 extends
GoogleAdsIO<GoogleAdsRow, SearchGoogleAdsStrea
* global (per pipeline or otherwise) rate limit to requests and should not
be used in deployments
* where the Google Ads API quota is shared between multiple applications.
*
- * <p>This policy can be used to limit requests across all {@link
GoogleAdsV19.Read} or {@link
- * GoogleAdsV19.ReadAll} transforms by defining and using a {@link
- * GoogleAdsV19.RateLimitPolicyFactory} which holds a shared static {@link
- * GoogleAdsV19.SimpleRateLimitPolicy}. Note that the desired rate must be
divided by the expected
+ * <p>This policy can be used to limit requests across all {@link
GoogleAdsV23.Read} or {@link
+ * GoogleAdsV23.ReadAll} transforms by defining and using a {@link
+ * GoogleAdsV23.RateLimitPolicyFactory} which holds a shared static {@link
+ * GoogleAdsV23.SimpleRateLimitPolicy}. Note that the desired rate must be
divided by the expected
* maximum number of workers for the pipeline, otherwise the pipeline may
exceed the desired rate
* after an upscaling event.
*
* <pre>{@code
* public class SimpleRateLimitPolicyFactory implements
GoogleAdsIO.RateLimitPolicyFactory {
* private static final GoogleAdsIO.RateLimitPolicy POLICY =
- * new GoogleAdsV19.SimpleRateLimitPolicy(1.0 / 1000.0);
+ * new GoogleAdsV23.SimpleRateLimitPolicy(1.0 / 1000.0);
*
* @Override
* public GoogleAdsIO.RateLimitPolicy getRateLimitPolicy() {
diff --git
a/sdks/java/io/google-ads/src/test/java/org/apache/beam/sdk/io/googleads/DummyRateLimitPolicy.java
b/sdks/java/io/google-ads/src/test/java/org/apache/beam/sdk/io/googleads/DummyRateLimitPolicy.java
index 56ca204db4f..205cba38c11 100644
---
a/sdks/java/io/google-ads/src/test/java/org/apache/beam/sdk/io/googleads/DummyRateLimitPolicy.java
+++
b/sdks/java/io/google-ads/src/test/java/org/apache/beam/sdk/io/googleads/DummyRateLimitPolicy.java
@@ -17,11 +17,11 @@
*/
package org.apache.beam.sdk.io.googleads;
-import com.google.ads.googleads.v19.errors.GoogleAdsError;
+import com.google.ads.googleads.v23.errors.GoogleAdsError;
import com.google.protobuf.Message;
import org.checkerframework.checker.nullness.qual.Nullable;
-public class DummyRateLimitPolicy implements
GoogleAdsV19.RateLimitPolicy<GoogleAdsError> {
+public class DummyRateLimitPolicy implements
GoogleAdsV23.RateLimitPolicy<GoogleAdsError> {
@Override
public void onBeforeRequest(@Nullable String developerToken, String
customerId, Message request)
throws InterruptedException {}
diff --git
a/sdks/java/io/google-ads/src/test/java/org/apache/beam/sdk/io/googleads/GoogleAdsIOTest.java
b/sdks/java/io/google-ads/src/test/java/org/apache/beam/sdk/io/googleads/GoogleAdsIOTest.java
index 29ac0995180..f2725600b72 100644
---
a/sdks/java/io/google-ads/src/test/java/org/apache/beam/sdk/io/googleads/GoogleAdsIOTest.java
+++
b/sdks/java/io/google-ads/src/test/java/org/apache/beam/sdk/io/googleads/GoogleAdsIOTest.java
@@ -20,18 +20,18 @@ package org.apache.beam.sdk.io.googleads;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.when;
-import
com.google.ads.googleads.v19.errors.AuthenticationErrorEnum.AuthenticationError;
-import com.google.ads.googleads.v19.errors.ErrorCode;
-import com.google.ads.googleads.v19.errors.ErrorDetails;
-import com.google.ads.googleads.v19.errors.GoogleAdsError;
-import com.google.ads.googleads.v19.errors.GoogleAdsException;
-import com.google.ads.googleads.v19.errors.GoogleAdsFailure;
-import com.google.ads.googleads.v19.errors.InternalErrorEnum.InternalError;
-import com.google.ads.googleads.v19.errors.QuotaErrorDetails;
-import com.google.ads.googleads.v19.errors.QuotaErrorEnum.QuotaError;
-import com.google.ads.googleads.v19.services.GoogleAdsRow;
-import com.google.ads.googleads.v19.services.SearchGoogleAdsStreamRequest;
-import com.google.ads.googleads.v19.services.SearchGoogleAdsStreamResponse;
+import
com.google.ads.googleads.v23.errors.AuthenticationErrorEnum.AuthenticationError;
+import com.google.ads.googleads.v23.errors.ErrorCode;
+import com.google.ads.googleads.v23.errors.ErrorDetails;
+import com.google.ads.googleads.v23.errors.GoogleAdsError;
+import com.google.ads.googleads.v23.errors.GoogleAdsException;
+import com.google.ads.googleads.v23.errors.GoogleAdsFailure;
+import com.google.ads.googleads.v23.errors.InternalErrorEnum.InternalError;
+import com.google.ads.googleads.v23.errors.QuotaErrorDetails;
+import com.google.ads.googleads.v23.errors.QuotaErrorEnum.QuotaError;
+import com.google.ads.googleads.v23.services.GoogleAdsRow;
+import com.google.ads.googleads.v23.services.SearchGoogleAdsStreamRequest;
+import com.google.ads.googleads.v23.services.SearchGoogleAdsStreamResponse;
import com.google.api.gax.grpc.GrpcStatusCode;
import com.google.api.gax.rpc.ApiException;
import com.google.protobuf.Duration;
@@ -294,15 +294,15 @@ public class GoogleAdsIOTest {
public void init() {
GoogleAdsOptions options =
pipeline.getOptions().as(GoogleAdsOptions.class);
options.setGoogleAdsCredentialFactoryClass(NoopCredentialFactory.class);
- synchronized (GoogleAdsV19.ReadAll.ReadAllFn.class) {
- GoogleAdsV19.ReadAll.ReadAllFn.sleeper = (long millis) -> {};
+ synchronized (GoogleAdsV23.ReadAll.ReadAllFn.class) {
+ GoogleAdsV23.ReadAll.ReadAllFn.sleeper = (long millis) -> {};
}
}
@Test
@Category(NeedsRunner.class)
public void testRead() {
- when(MockGoogleAdsClientFactory.GOOGLE_ADS_SERVICE_STUB_V19
+ when(MockGoogleAdsClientFactory.GOOGLE_ADS_SERVICE_STUB_V23
.searchStreamCallable()
.call(any(SearchGoogleAdsStreamRequest.class))
.iterator())
@@ -331,7 +331,7 @@ public class GoogleAdsIOTest {
@Test
@Category(NeedsRunner.class)
public void testReadWithFailureFromMaxRetriesExceeded() throws Exception {
- when(MockGoogleAdsClientFactory.GOOGLE_ADS_SERVICE_STUB_V19
+ when(MockGoogleAdsClientFactory.GOOGLE_ADS_SERVICE_STUB_V23
.searchStreamCallable()
.call(any(SearchGoogleAdsStreamRequest.class)))
.thenThrow(
@@ -370,7 +370,7 @@ public class GoogleAdsIOTest {
@Test
@Category(NeedsRunner.class)
public void testReadWithFailureFromNonRetryableError() throws Exception {
- when(MockGoogleAdsClientFactory.GOOGLE_ADS_SERVICE_STUB_V19
+ when(MockGoogleAdsClientFactory.GOOGLE_ADS_SERVICE_STUB_V23
.searchStreamCallable()
.call(any(SearchGoogleAdsStreamRequest.class)))
.thenThrow(
@@ -403,7 +403,7 @@ public class GoogleAdsIOTest {
pipeline::run);
Assert.assertEquals(IOException.class, exception.getCause().getClass());
Assert.assertEquals(
- "com.google.ads.googleads.v19.errors.GoogleAdsException: errors {\n"
+ "com.google.ads.googleads.v23.errors.GoogleAdsException: errors {\n"
+ " error_code {\n"
+ " authentication_error: OAUTH_TOKEN_REVOKED\n"
+ " }\n"
@@ -414,7 +414,7 @@ public class GoogleAdsIOTest {
@Test
@Category(NeedsRunner.class)
public void testReadWithRecoveryFromInternalError() throws Exception {
- when(MockGoogleAdsClientFactory.GOOGLE_ADS_SERVICE_STUB_V19
+ when(MockGoogleAdsClientFactory.GOOGLE_ADS_SERVICE_STUB_V23
.searchStreamCallable()
.call(any(SearchGoogleAdsStreamRequest.class))
.iterator())
@@ -465,7 +465,7 @@ public class GoogleAdsIOTest {
@Test
@Category(NeedsRunner.class)
public void testReadWithRecoveryFromQuotaErrorWithRetryDelay() throws
Exception {
- when(MockGoogleAdsClientFactory.GOOGLE_ADS_SERVICE_STUB_V19
+ when(MockGoogleAdsClientFactory.GOOGLE_ADS_SERVICE_STUB_V23
.searchStreamCallable()
.call(any(SearchGoogleAdsStreamRequest.class))
.iterator())
diff --git
a/sdks/java/io/google-ads/src/test/java/org/apache/beam/sdk/io/googleads/MockGoogleAdsClientFactory.java
b/sdks/java/io/google-ads/src/test/java/org/apache/beam/sdk/io/googleads/MockGoogleAdsClientFactory.java
index 6ff6ef92e9e..e92cff8808a 100644
---
a/sdks/java/io/google-ads/src/test/java/org/apache/beam/sdk/io/googleads/MockGoogleAdsClientFactory.java
+++
b/sdks/java/io/google-ads/src/test/java/org/apache/beam/sdk/io/googleads/MockGoogleAdsClientFactory.java
@@ -23,12 +23,12 @@ import static org.mockito.Mockito.when;
import static org.mockito.Mockito.withSettings;
import com.google.ads.googleads.lib.GoogleAdsClient;
-import com.google.ads.googleads.v19.services.GoogleAdsServiceClient;
-import com.google.ads.googleads.v19.services.stub.GoogleAdsServiceStub;
+import com.google.ads.googleads.v23.services.GoogleAdsServiceClient;
+import com.google.ads.googleads.v23.services.stub.GoogleAdsServiceStub;
import org.checkerframework.checker.nullness.qual.Nullable;
class MockGoogleAdsClientFactory implements GoogleAdsClientFactory {
- static final GoogleAdsServiceStub GOOGLE_ADS_SERVICE_STUB_V19 =
+ static final GoogleAdsServiceStub GOOGLE_ADS_SERVICE_STUB_V23 =
mock(GoogleAdsServiceStub.class,
withSettings().defaultAnswer(RETURNS_DEEP_STUBS));
@Override
@@ -39,8 +39,8 @@ class MockGoogleAdsClientFactory implements
GoogleAdsClientFactory {
@Nullable Long loginCustomerId) {
GoogleAdsClient mockGoogleAdsClient =
mock(GoogleAdsClient.class,
withSettings().defaultAnswer(RETURNS_DEEP_STUBS));
- when(mockGoogleAdsClient.getVersion19().createGoogleAdsServiceClient())
-
.thenReturn(GoogleAdsServiceClient.create(GOOGLE_ADS_SERVICE_STUB_V19));
+ when(mockGoogleAdsClient.getVersion23().createGoogleAdsServiceClient())
+
.thenReturn(GoogleAdsServiceClient.create(GOOGLE_ADS_SERVICE_STUB_V23));
return mockGoogleAdsClient;
}
}