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

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

                Author: ASF GitHub Bot
            Created on: 14/Apr/21 17:29
            Start Date: 14/Apr/21 17:29
    Worklog Time Spent: 10m 
      Work Description: nehsyc commented on a change in pull request #14530:
URL: https://github.com/apache/beam/pull/14530#discussion_r613440809



##########
File path: 
sdks/java/core/src/main/java/org/apache/beam/sdk/util/IdentityWindowFn.java
##########
@@ -63,14 +62,16 @@ public IdentityWindowFn(Coder<? extends BoundedWindow> 
coder) {
   }
 
   @Override
-  public Collection<BoundedWindow> assignWindows(WindowFn<T, 
BoundedWindow>.AssignContext c)
-      throws Exception {
+  public Collection<BoundedWindow> assignWindows(WindowFn<T, 
BoundedWindow>.AssignContext c) {
     // The window is provided by the prior WindowFn, which also provides the 
coder for them
     return Collections.singleton(c.window());
   }
 
   @Override
   public boolean isCompatible(WindowFn<?, ?> other) {
+    // Only compatible with itself.
+    if (this.equals(other)) return true;

Review comment:
       This was needed because for stateful DoFn, the direct runner replaces it 
with `GbkThenStatefulParDo` which applies a windowing without an explicit 
window fn:
   
https://github.com/apache/beam/blob/2db98ee64a36a2e15b7a8873fbbecb8a4e3e36d9/runners/direct-java/src/main/java/org/apache/beam/runners/direct/ParDoMultiOverrideFactory.java#L202
   
   which triggers a `Flatten` of the input although in this case there is only 
one input pcollection:
   
https://github.com/apache/beam/blob/2db98ee64a36a2e15b7a8873fbbecb8a4e3e36d9/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/windowing/Window.java#L407
   
   `Flatten` requires the windowing of the input(s) to be compatible including 
with itself:
   
https://github.com/apache/beam/blob/2db98ee64a36a2e15b7a8873fbbecb8a4e3e36d9/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Flatten.java#L104
   
   So two options AFAIT:
   - Allowing `IdentityWindowFn` to be compatible with itself (which makes 
sense I guess?)
   - Skipping windowing fn comparison for the same input PCollection in 
`Flatten`




-- 
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: 582720)
    Time Spent: 3h 50m  (was: 3h 40m)

> WriteFiles withRunnerDeterminedShardingUnbounded doesn't work with session 
> windows
> ----------------------------------------------------------------------------------
>
>                 Key: BEAM-12040
>                 URL: https://issues.apache.org/jira/browse/BEAM-12040
>             Project: Beam
>          Issue Type: Improvement
>          Components: io-java-files
>            Reporter: Siyuan Chen
>            Priority: P2
>          Time Spent: 3h 50m
>  Remaining Estimate: 0h
>
> Currently the implementation of `withRunnerDeterminedShardingUnbounded` uses 
> a stateful DoFn to achieve the grouping and batching of the input elements, 
> which doesn't support session windows. One possible way is to add another GBK 
> prior to the stateful DoFn to first get session windows merged and reify the 
> window before invoking the sateful DoFn. 



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

Reply via email to