Make Canonical ViewFns Public Mark all of the ViewFns as both deprecated and experimental. These fns will all be removed once Runners have multimap support, and are not suitable for users to use explicitly.
Project: http://git-wip-us.apache.org/repos/asf/beam/repo Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/ee1b835e Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/ee1b835e Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/ee1b835e Branch: refs/heads/master Commit: ee1b835eebdcdc1db3cc7270ca5181ff90b2fde7 Parents: 87c8ef0 Author: Thomas Groh <[email protected]> Authored: Thu Mar 23 15:23:40 2017 -0700 Committer: Thomas Groh <[email protected]> Committed: Thu Mar 23 18:21:19 2017 -0700 ---------------------------------------------------------------------- .../apache/beam/sdk/util/PCollectionViews.java | 42 ++++++++++++++++---- 1 file changed, 34 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/beam/blob/ee1b835e/sdks/java/core/src/main/java/org/apache/beam/sdk/util/PCollectionViews.java ---------------------------------------------------------------------- diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/PCollectionViews.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/PCollectionViews.java index 83ccae8..848d8b3 100644 --- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/PCollectionViews.java +++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/PCollectionViews.java @@ -32,6 +32,8 @@ import java.util.NoSuchElementException; import java.util.Objects; import javax.annotation.Nullable; import org.apache.beam.sdk.Pipeline; +import org.apache.beam.sdk.annotations.Experimental; +import org.apache.beam.sdk.annotations.Experimental.Kind; import org.apache.beam.sdk.coders.Coder; import org.apache.beam.sdk.coders.IterableCoder; import org.apache.beam.sdk.transforms.ViewFn; @@ -228,8 +230,13 @@ public class PCollectionViews { * <p>For internal use only. * * <p>Instantiate via {@link PCollectionViews#singletonView}. + * + * @deprecated Beam views are migrating off of {@code Iterable<WindowedValue<T>>} as a primitive + * view type. */ - private static class SingletonViewFn<T> extends ViewFn<Iterable<WindowedValue<T>>, T> { + @Deprecated + @Experimental(Kind.CORE_RUNNERS_ONLY) + public static class SingletonViewFn<T> extends ViewFn<Iterable<WindowedValue<T>>, T> { @Nullable private byte[] encodedDefaultValue; @Nullable private transient T defaultValue; @Nullable private Coder<T> valueCoder; @@ -292,8 +299,13 @@ public class PCollectionViews { * <p>For internal use only. * * <p>Instantiate via {@link PCollectionViews#iterableView}. + * + * @deprecated Beam views are migrating off of {@code Iterable<WindowedValue<T>>} as a primitive + * view type. */ - private static class IterableViewFn<T> + @Deprecated + @Experimental(Kind.CORE_RUNNERS_ONLY) + public static class IterableViewFn<T> extends ViewFn<Iterable<WindowedValue<T>>, Iterable<T>> { @Override @@ -315,8 +327,13 @@ public class PCollectionViews { * <p>For internal use only. * * <p>Instantiate via {@link PCollectionViews#listView}. + * + * @deprecated Beam views are migrating off of {@code Iterable<WindowedValue<T>>} as a primitive + * view type. */ - private static class ListViewFn<T> extends ViewFn<Iterable<WindowedValue<T>>, List<T>> { + @Deprecated + @Experimental(Kind.CORE_RUNNERS_ONLY) + public static class ListViewFn<T> extends ViewFn<Iterable<WindowedValue<T>>, List<T>> { @Override public List<T> apply(Iterable<WindowedValue<T>> contents) { return ImmutableList.copyOf( @@ -333,8 +350,13 @@ public class PCollectionViews { /** * Implementation of conversion {@code Iterable<WindowedValue<KV<K, V>>>} * to {@code Map<K, Iterable<V>>}. + * + * @deprecated Beam views are migrating off of {@code Iterable<WindowedValue<T>>} as a primitive + * view type. */ - private static class MultimapViewFn<K, V> + @Deprecated + @Experimental(Kind.CORE_RUNNERS_ONLY) + public static class MultimapViewFn<K, V> extends ViewFn<Iterable<WindowedValue<KV<K, V>>>, Map<K, Iterable<V>>> { @Override @@ -352,11 +374,15 @@ public class PCollectionViews { } /** - * Implementation of conversion {@code Iterable<WindowedValue<KV<K, V>>} with one value per key - * to {@code Map<K, V>}. + * Implementation of conversion {@code Iterable<WindowedValue<KV<K, V>>} with one value per key to + * {@code Map<K, V>}. + * + * @deprecated Beam views are migrating off of {@code Iterable<WindowedValue<T>>} as a primitive + * view type. */ - private static class MapViewFn<K, V> - extends ViewFn<Iterable<WindowedValue<KV<K, V>>>, Map<K, V>> { + @Deprecated + @Experimental(Kind.CORE_RUNNERS_ONLY) + public static class MapViewFn<K, V> extends ViewFn<Iterable<WindowedValue<KV<K, V>>>, Map<K, V>> { /** * Input iterable must actually be {@code Iterable<WindowedValue<KV<K, V>>>}. */
