This is an automated email from the ASF dual-hosted git repository. scott pushed a commit to branch release-2.10.0 in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/release-2.10.0 by this push: new 709fff9 [BEAM-6545] Remove useless allowance of null constructor in ByteArrayShufflePosition new d69cd66 Merge pull request #7698: [BEAM-6545] Cherrypick #7667 to release-2.10.0: Remove useless allowance of null constructor in ByteArrayShufflePosition 709fff9 is described below commit 709fff940c00082ee3c934ee8dfea75cf420edbb Author: Kenneth Knowles <k...@google.com> AuthorDate: Tue Jan 29 20:51:58 2019 -0800 [BEAM-6545] Remove useless allowance of null constructor in ByteArrayShufflePosition --- .../beam/runners/dataflow/worker/GroupingShuffleReader.java | 8 ++++++-- .../beam/runners/dataflow/worker/PartitioningShuffleReader.java | 8 ++++++-- .../beam/runners/dataflow/worker/UngroupedShuffleReader.java | 8 ++++++-- .../worker/util/common/worker/ByteArrayShufflePosition.java | 4 ++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/GroupingShuffleReader.java b/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/GroupingShuffleReader.java index e840bfb..d2e5bc4 100644 --- a/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/GroupingShuffleReader.java +++ b/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/GroupingShuffleReader.java @@ -235,8 +235,12 @@ public class GroupingShuffleReader<K, V> extends NativeReader<WindowedValue<KV<K this.groups = new GroupingShuffleEntryIterator( entryReader, - ByteArrayShufflePosition.fromBase64(parentReader.startShufflePosition), - ByteArrayShufflePosition.fromBase64(parentReader.stopShufflePosition)) { + parentReader.startShufflePosition == null + ? null + : ByteArrayShufflePosition.fromBase64(parentReader.startShufflePosition), + parentReader.stopShufflePosition == null + ? null + : ByteArrayShufflePosition.fromBase64(parentReader.stopShufflePosition)) { @Override protected void notifyElementRead(long byteSize) { // We accumulate the sum of bytes read in a local variable. This sum will be counted diff --git a/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/PartitioningShuffleReader.java b/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/PartitioningShuffleReader.java index ad92be4..7bbbdd2 100644 --- a/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/PartitioningShuffleReader.java +++ b/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/PartitioningShuffleReader.java @@ -119,8 +119,12 @@ public class PartitioningShuffleReader<K, V> extends NativeReader<WindowedValue< PartitioningShuffleReader<K, V> shuffleReader, ShuffleEntryReader entryReader) { this.iterator = entryReader.read( - ByteArrayShufflePosition.fromBase64(shuffleReader.startShufflePosition), - ByteArrayShufflePosition.fromBase64(shuffleReader.stopShufflePosition)); + shuffleReader.startShufflePosition == null + ? null + : ByteArrayShufflePosition.fromBase64(shuffleReader.startShufflePosition), + shuffleReader.stopShufflePosition == null + ? null + : ByteArrayShufflePosition.fromBase64(shuffleReader.stopShufflePosition)); this.shuffleReader = shuffleReader; this.entryReader = entryReader; } diff --git a/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/UngroupedShuffleReader.java b/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/UngroupedShuffleReader.java index d43c1cd..77d5ae1 100644 --- a/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/UngroupedShuffleReader.java +++ b/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/UngroupedShuffleReader.java @@ -88,8 +88,12 @@ public class UngroupedShuffleReader<T> extends NativeReader<T> { UngroupedShuffleReader<T> shuffleReader, ShuffleEntryReader entryReader) { this.iterator = entryReader.read( - ByteArrayShufflePosition.fromBase64(shuffleReader.startShufflePosition), - ByteArrayShufflePosition.fromBase64(shuffleReader.stopShufflePosition)); + shuffleReader.startShufflePosition == null + ? null + : ByteArrayShufflePosition.fromBase64(shuffleReader.startShufflePosition), + shuffleReader.stopShufflePosition == null + ? null + : ByteArrayShufflePosition.fromBase64(shuffleReader.stopShufflePosition)); this.shuffleReader = shuffleReader; this.entryReader = entryReader; } diff --git a/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/util/common/worker/ByteArrayShufflePosition.java b/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/util/common/worker/ByteArrayShufflePosition.java index 6cd4122..718a3e9 100644 --- a/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/util/common/worker/ByteArrayShufflePosition.java +++ b/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/util/common/worker/ByteArrayShufflePosition.java @@ -38,11 +38,11 @@ public class ByteArrayShufflePosition implements Comparable<ShufflePosition>, Sh this.position = position; } - public static ByteArrayShufflePosition fromBase64(@Nullable String position) { + public static ByteArrayShufflePosition fromBase64(String position) { return ByteArrayShufflePosition.of(decodeBase64(position)); } - public static ByteArrayShufflePosition of(@Nullable byte[] position) { + public static ByteArrayShufflePosition of(byte[] position) { if (position == null) { return null; }