You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by tg...@apache.org on 2017/03/29 23:26:10 UTC
[1/2] beam git commit: Remove View indicator classes
Repository: beam
Updated Branches:
refs/heads/master 8fa115955 -> 5d460d2e9
Remove View indicator classes
With the latest Dataflow Worker, these indicator classes have been
replaced everywhere by referencing the available ViewFns.
Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/6933465d
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/6933465d
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/6933465d
Branch: refs/heads/master
Commit: 6933465d659d6addeb30bbd5042c7b96834e418c
Parents: 8fa1159
Author: Thomas Groh <tg...@google.com>
Authored: Wed Mar 29 09:53:38 2017 -0700
Committer: Thomas Groh <tg...@google.com>
Committed: Wed Mar 29 13:16:31 2017 -0700
----------------------------------------------------------------------
.../apache/beam/sdk/util/PCollectionViews.java | 148 +++----------------
1 file changed, 18 insertions(+), 130 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/beam/blob/6933465d/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 848d8b3..0794703 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
@@ -65,14 +65,11 @@ public class PCollectionViews {
boolean hasDefault,
@Nullable T defaultValue,
Coder<T> valueCoder) {
- // TODO: as soon as runners are ported off the indicator classes,
- // return new SimplePCollectionView<>(
- // pipeline,
- // new SingletonViewFn<K, V>(hasDefault, defaultValue, valueCoder),
- // windowingStrategy,
- // valueCoder);
- return new SingletonPCollectionView<>(
- pipeline, windowingStrategy, hasDefault, defaultValue, valueCoder);
+ return new SimplePCollectionView<>(
+ pipeline,
+ new SingletonViewFn<>(hasDefault, defaultValue, valueCoder),
+ windowingStrategy,
+ valueCoder);
}
/**
@@ -83,10 +80,8 @@ public class PCollectionViews {
Pipeline pipeline,
WindowingStrategy<?, W> windowingStrategy,
Coder<T> valueCoder) {
- // TODO: as soon as runners are ported off the indicator classes,
- // return new SimplePCollectionView<>(
- // pipeline, new IterableViewFn<T>(), windowingStrategy, valueCoder);
- return new IterablePCollectionView<>(pipeline, windowingStrategy, valueCoder);
+ return new SimplePCollectionView<>(
+ pipeline, new IterableViewFn<T>(), windowingStrategy, valueCoder);
}
/**
@@ -97,10 +92,8 @@ public class PCollectionViews {
Pipeline pipeline,
WindowingStrategy<?, W> windowingStrategy,
Coder<T> valueCoder) {
- // TODO: as soon as runners are ported off the indicator classes,
- // return new SimplePCollectionView<>(
- // pipeline, new ListViewFn<T>(), windowingStrategy, valueCoder);
- return new ListPCollectionView<>(pipeline, windowingStrategy, valueCoder);
+ return new SimplePCollectionView<>(
+ pipeline, new ListViewFn<T>(), windowingStrategy, valueCoder);
}
/**
@@ -108,13 +101,9 @@ public class PCollectionViews {
* provided {@link Coder} and windowed using the provided {@link WindowingStrategy}.
*/
public static <K, V, W extends BoundedWindow> PCollectionView<Map<K, V>> mapView(
- Pipeline pipeline,
- WindowingStrategy<?, W> windowingStrategy,
- Coder<KV<K, V>> valueCoder) {
- // TODO: as soon as runners are ported off the indicator classes,
- // return new SimplePCollectionView<>(
- // pipeline, new MapViewFn<K, V>(), windowingStrategy, valueCoder);
- return new MapPCollectionView<>(pipeline, windowingStrategy, valueCoder);
+ Pipeline pipeline, WindowingStrategy<?, W> windowingStrategy, Coder<KV<K, V>> valueCoder) {
+ return new SimplePCollectionView<>(
+ pipeline, new MapViewFn<K, V>(), windowingStrategy, valueCoder);
}
/**
@@ -125,105 +114,10 @@ public class PCollectionViews {
Pipeline pipeline,
WindowingStrategy<?, W> windowingStrategy,
Coder<KV<K, V>> valueCoder) {
- // TODO: as soon as runners are ported off the indicator classes,
- // return new SimplePCollectionView<>(
- // pipeline, new MultimapViewFn<K, V>(), windowingStrategy, valueCoder);
- return new MultimapPCollectionView<>(pipeline, windowingStrategy, valueCoder);
- }
-
- /**
- * A public indicator class that this view is a singleton view.
- *
- * @deprecated Runners should not inspect the {@link PCollectionView} subclass, as it is an
- * implementation detail. To specialize a side input, a runner should inspect the
- * language-independent metadata of the {@link ViewFn}.
- */
- @Deprecated
- public static class SingletonPCollectionView<T, W extends BoundedWindow>
- extends SimplePCollectionView<T, T, W> {
- public SingletonPCollectionView(
- Pipeline pipeline,
- WindowingStrategy<?, W> windowingStrategy,
- boolean hasDefault,
- T defaultValue,
- Coder<T> valueCoder) {
- super(
- pipeline,
- new SingletonViewFn<>(hasDefault, defaultValue, valueCoder),
- windowingStrategy,
- valueCoder);
- }
-
- public T getDefaultValue() {
- return ((SingletonViewFn<T>) viewFn).getDefaultValue();
- }
- }
-
- /**
- * A public indicator class that this view is an iterable view.
- *
- * @deprecated Runners should not inspect the {@link PCollectionView} subclass, as it is an
- * implementation detail. To specialize a side input, a runner should inspect the
- * language-independent metadata of the {@link ViewFn}.
- */
- @Deprecated
- public static class IterablePCollectionView<ElemT, W extends BoundedWindow>
- extends SimplePCollectionView<ElemT, Iterable<ElemT>, W> {
- public IterablePCollectionView(
- Pipeline pipeline, WindowingStrategy<?, W> windowingStrategy, Coder<ElemT> valueCoder) {
- super(pipeline, new IterableViewFn<ElemT>(), windowingStrategy, valueCoder);
- }
- }
-
- /**
- * A public indicator class that this view is a list view.
- *
- * @deprecated Runners should not inspect the {@link PCollectionView} subclass, as it is an
- * implementation detail. To specialize a side input, a runner should inspect the
- * language-independent metadata of the {@link ViewFn}.
- */
- @Deprecated
- public static class ListPCollectionView<ElemT, W extends BoundedWindow>
- extends SimplePCollectionView<ElemT, List<ElemT>, W> {
- public ListPCollectionView(
- Pipeline pipeline, WindowingStrategy<?, W> windowingStrategy, Coder<ElemT> valueCoder) {
- super(pipeline, new ListViewFn<ElemT>(), windowingStrategy, valueCoder);
- }
- }
-
- /**
- * A public indicator class that this view is a map view.
- *
- * @deprecated Runners should not inspect the {@link PCollectionView} subclass, as it is an
- * implementation detail. To specialize a side input, a runner should inspect the
- * language-independent metadata of the {@link ViewFn}.
- */
- @Deprecated
- public static class MapPCollectionView<K, V, W extends BoundedWindow>
- extends SimplePCollectionView<KV<K, V>, Map<K, V>, W> {
- public MapPCollectionView(
- Pipeline pipeline, WindowingStrategy<?, W> windowingStrategy, Coder<KV<K, V>> valueCoder) {
- super(pipeline, new MapViewFn<K, V>(), windowingStrategy, valueCoder);
- }
- }
-
- /**
- * A public indicator class that this view is a multimap view.
- *
- * @deprecated Runners should not inspect the {@link PCollectionView} subclass, as it is an
- * implementation detail. To specialize a side input, a runner should inspect the
- * language-independent metadata of the {@link ViewFn}.
- */
- @Deprecated
- public static class MultimapPCollectionView<K, V, W extends BoundedWindow>
- extends SimplePCollectionView<KV<K, V>, Map<K, Iterable<V>>, W> {
- public MultimapPCollectionView(
- Pipeline pipeline, WindowingStrategy<?, W> windowingStrategy, Coder<KV<K, V>> valueCoder) {
- super(pipeline, new MultimapViewFn<K, V>(), windowingStrategy, valueCoder);
- }
+ return new SimplePCollectionView<>(
+ pipeline, new MultimapViewFn<K, V>(), windowingStrategy, valueCoder);
}
-
/**
* Implementation of conversion of singleton {@code Iterable<WindowedValue<T>>} to {@code T}.
*
@@ -401,7 +295,7 @@ public class PCollectionViews {
}
/**
- * A base class for {@link PCollectionView} implementations, with additional type parameters
+ * A class for {@link PCollectionView} implementations, with additional type parameters
* that are not visible at pipeline assembly time when the view is used as a side input.
*/
private static class SimplePCollectionView<ElemT, ViewT, W extends BoundedWindow>
@@ -418,19 +312,14 @@ public class PCollectionViews {
/**
* The typed {@link ViewFn} for this view.
- *
- * @deprecated Access to this variable from subclasses is temporary, for migrating away
- * from language-specific inspections.
*/
- @Deprecated
- protected ViewFn<Iterable<WindowedValue<ElemT>>, ViewT> viewFn;
+ private ViewFn<Iterable<WindowedValue<ElemT>>, ViewT> viewFn;
/**
* Call this constructor to initialize the fields for which this base class provides
* boilerplate accessors.
*/
- // TODO: make private as soon as runners are ported off indicator subclasses
- protected SimplePCollectionView(
+ private SimplePCollectionView(
Pipeline pipeline,
TupleTag<Iterable<WindowedValue<ElemT>>> tag,
ViewFn<Iterable<WindowedValue<ElemT>>, ViewT> viewFn,
@@ -452,8 +341,7 @@ public class PCollectionViews {
* Call this constructor to initialize the fields for which this base class provides
* boilerplate accessors, with an auto-generated tag.
*/
- // TODO: make private as soon as runners are ported off indicator subclasses
- protected SimplePCollectionView(
+ private SimplePCollectionView(
Pipeline pipeline,
ViewFn<Iterable<WindowedValue<ElemT>>, ViewT> viewFn,
WindowingStrategy<?, W> windowingStrategy,
[2/2] beam git commit: This closes #2360
Posted by tg...@apache.org.
This closes #2360
Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/5d460d2e
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/5d460d2e
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/5d460d2e
Branch: refs/heads/master
Commit: 5d460d2e986fc9b549260bafcb2e26249f2ed3bb
Parents: 8fa1159 6933465
Author: Thomas Groh <tg...@google.com>
Authored: Wed Mar 29 16:25:54 2017 -0700
Committer: Thomas Groh <tg...@google.com>
Committed: Wed Mar 29 16:25:54 2017 -0700
----------------------------------------------------------------------
.../apache/beam/sdk/util/PCollectionViews.java | 148 +++----------------
1 file changed, 18 insertions(+), 130 deletions(-)
----------------------------------------------------------------------