From cb9e7fb19699b002aa9245a4d1e7e36a1db31f4a Mon Sep 17 00:00:00 2001 From: Ahmed Abualsaud Date: Mon, 16 Sep 2024 06:45:20 -0400 Subject: [PATCH] spotless --- .../beam/sdk/io/gcp/pubsub/PreparePubsubWriteDoFn.java | 9 +++------ .../java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.java | 1 - 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PreparePubsubWriteDoFn.java b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PreparePubsubWriteDoFn.java index a3c54d622251..6df3f1a8e9cf 100644 --- a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PreparePubsubWriteDoFn.java +++ b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PreparePubsubWriteDoFn.java @@ -38,10 +38,9 @@ public class PreparePubsubWriteDoFn extends DoFn private static final int PUBSUB_MESSAGE_MAX_ATTRIBUTES = 100; private static final int PUBSUB_MESSAGE_ATTRIBUTE_MAX_KEY_BYTES = 256; private static final int PUBSUB_MESSAGE_ATTRIBUTE_MAX_VALUE_BYTES = 1024; - private static final int ORDERING_KEY_MAX_VALUE_BYTES = 1024; + private static final int ORDERING_KEY_MAX_BYTE_SIZE = 1024; // The amount of bytes that each attribute entry adds up to the request private static final int PUBSUB_MESSAGE_ATTRIBUTE_ENCODE_ADDITIONAL_BYTES = 6; - private boolean allowOrderingKey; private int maxPublishBatchSize; private SerializableFunction, PubsubMessage> formatFunction; @@ -71,12 +70,12 @@ static int validatePubsubMessageSize(PubsubMessage message, int maxPublishBatchS @Nullable String orderingKey = message.getOrderingKey(); if (orderingKey != null) { int orderingKeySize = orderingKey.getBytes(StandardCharsets.UTF_8).length; - if (orderingKeySize > ORDERING_KEY_MAX_VALUE_BYTES) { + if (orderingKeySize > ORDERING_KEY_MAX_BYTE_SIZE) { throw new SizeLimitExceededException( "Pubsub message ordering key of length " + orderingKeySize + " exceeds maximum of " - + ORDERING_KEY_MAX_VALUE_BYTES + + ORDERING_KEY_MAX_BYTE_SIZE + " bytes. See https://cloud.google.com/pubsub/quotas#resource_limits"); } totalSize += orderingKeySize; @@ -141,14 +140,12 @@ static int validatePubsubMessageSize(PubsubMessage message, int maxPublishBatchS SerializableFunction, PubsubMessage> formatFunction, @Nullable SerializableFunction, PubsubIO.PubsubTopic> topicFunction, - boolean allowOrderingKey, int maxPublishBatchSize, BadRecordRouter badRecordRouter, Coder inputCoder, TupleTag outputTag) { this.formatFunction = formatFunction; this.topicFunction = topicFunction; - this.allowOrderingKey = allowOrderingKey; this.maxPublishBatchSize = maxPublishBatchSize; this.badRecordRouter = badRecordRouter; this.inputCoder = inputCoder; diff --git a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.java b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.java index 6224a1b817e0..1694083aeeca 100644 --- a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.java +++ b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.java @@ -1543,7 +1543,6 @@ public PDone expand(PCollection input) { new PreparePubsubWriteDoFn<>( getFormatFn(), topicFunction, - getNeedsOrderingKey(), maxMessageSize, getBadRecordRouter(), input.getCoder(),