[
https://issues.apache.org/jira/browse/BEAM-6855?focusedWorklogId=316012&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-316012
]
ASF GitHub Bot logged work on BEAM-6855:
----------------------------------------
Author: ASF GitHub Bot
Created on: 21/Sep/19 00:50
Start Date: 21/Sep/19 00:50
Worklog Time Spent: 10m
Work Description: reuvenlax commented on pull request #9612: [BEAM-6855]
Side inputs are not supported when using the state API
URL: https://github.com/apache/beam/pull/9612#discussion_r326839653
##########
File path:
sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/ParDoTest.java
##########
@@ -2294,6 +2294,47 @@ public void processElement(
.containsInAnyOrder(Lists.newArrayList(12, 42, 84, 97),
Lists.newArrayList(0, 1, 2));
pipeline.run();
}
+
+ @Test
+ @Category({ValidatesRunner.class, UsesStatefulParDo.class,
UsesSideInputs.class})
+ public void testStateSideInput() {
+ final PCollectionView<Integer> sideInput =
+ pipeline
+ .apply("CreateSideInput1", Create.of(2))
+ .apply("ViewSideInput1", View.asSingleton());
+
+ TestSimpleStatefulDoFn fn = new TestSimpleStatefulDoFn(sideInput);
+ pipeline.apply(Create.of(KV.of(1,
2))).apply(ParDo.of(fn).withSideInputs(sideInput));
+
+ pipeline.run();
+ }
+
+ private static class TestSimpleStatefulDoFn extends DoFn<KV<Integer,
Integer>, Integer> {
+
+ private final PCollectionView<Integer> view;
+
+ @StateId("foo")
+ private final StateSpec<ValueState<Integer>> spec =
StateSpecs.value(VarIntCoder.of());
+
+ private TestSimpleStatefulDoFn(PCollectionView<Integer> view) {
+ this.view = view;
+ }
+
+ @ProcessElement
+ public void processElem(ProcessContext c) {
+ // noop
Review comment:
can you add code here to access the state and the side input?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 316012)
Time Spent: 5h 20m (was: 5h 10m)
> Side inputs are not supported when using the state API
> ------------------------------------------------------
>
> Key: BEAM-6855
> URL: https://issues.apache.org/jira/browse/BEAM-6855
> Project: Beam
> Issue Type: Bug
> Components: runner-core, runner-dataflow, runner-direct
> Reporter: Reuven Lax
> Assignee: Shehzaad Nakhoda
> Priority: Major
> Time Spent: 5h 20m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)