[ 
https://issues.apache.org/jira/browse/BEAM-2939?focusedWorklogId=393868&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-393868
 ]

ASF GitHub Bot logged work on BEAM-2939:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 27/Feb/20 00:27
            Start Date: 27/Feb/20 00:27
    Worklog Time Spent: 10m 
      Work Description: boyuanzz commented on pull request #10897: [BEAM-2939] 
Java UnboundedSource SDF wrapper
URL: https://github.com/apache/beam/pull/10897#discussion_r384840768
 
 

 ##########
 File path: sdks/java/core/src/main/java/org/apache/beam/sdk/io/Read.java
 ##########
 @@ -185,6 +200,37 @@ private Unbounded(@Nullable String name, 
UnboundedSource<T, ?> source) {
     @Override
     public final PCollection<T> expand(PBegin input) {
       source.validate();
+
+      if (ExperimentalOptions.hasExperiment(input.getPipeline().getOptions(), 
"beam_fn_api")
+          && !ExperimentalOptions.hasExperiment(
+              input.getPipeline().getOptions(), 
"beam_fn_api_use_deprecated_read")) {
+        // We don't use Create here since Create is defined as a BoundedSource 
and using it would
+        // cause an infinite expansion loop. We can reconsider this if Create 
is implemented
+        // directly as a SplittableDoFn.
+        PCollection<ValueWithRecordId<T>> outputWithIds =
+            input
+                .getPipeline()
+                .apply(Impulse.create())
+                .apply(
+                    MapElements.into(new TypeDescriptor<UnboundedSource<T, 
CheckpointMark>>() {})
+                        .via(element -> (UnboundedSource<T, CheckpointMark>) 
source))
+                .setCoder(
+                    SerializableCoder.of(
+                        new TypeDescriptor<UnboundedSource<T, 
CheckpointMark>>() {}))
+                .apply(
+                    ParDo.of(
+                        new UnboundedSourceAsSDFWrapperFn<>(
+                            (Coder<CheckpointMark>) 
source.getCheckpointMarkCoder())))
+                .setCoder(ValueWithRecordIdCoder.of(source.getOutputCoder()));
+        if (source.requiresDeduping()) {
+          outputWithIds.apply(
+              Distinct.<ValueWithRecordId<T>, byte[]>withRepresentativeValueFn(
 
 Review comment:
   I'm curious what `WindowingStrategy` is going to apply here. If it's using 
`GlobalWindow`, will it work in streaming mode?
 
----------------------------------------------------------------
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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 393868)
    Time Spent: 21h  (was: 20h 50m)

> Fn API SDF support
> ------------------
>
>                 Key: BEAM-2939
>                 URL: https://issues.apache.org/jira/browse/BEAM-2939
>             Project: Beam
>          Issue Type: Improvement
>          Components: beam-model
>            Reporter: Henning Rohde
>            Assignee: Luke Cwik
>            Priority: Major
>              Labels: portability
>          Time Spent: 21h
>  Remaining Estimate: 0h
>
> The Fn API should support streaming SDF. Detailed design TBD.
> Once design is ready, expand subtasks similarly to BEAM-2822.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to