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

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

                Author: ASF GitHub Bot
            Created on: 12/Jul/19 06:31
            Start Date: 12/Jul/19 06:31
    Worklog Time Spent: 10m 
      Work Description: amaliujia commented on pull request #9032: [BEAM-7386] 
Bi-Temporal Join
URL: https://github.com/apache/beam/pull/9032#discussion_r302838285
 
 

 ##########
 File path: 
sdks/java/extensions/timeseries/src/main/java/org/apache/beam/sdk/extensions/timeseries/joins/BiStreamJoinResultCoder.java
 ##########
 @@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.extensions.timeseries.joins;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.List;
+import org.apache.beam.sdk.coders.*;
+import org.apache.beam.sdk.values.TimestampedValue;
+import org.apache.beam.sdk.values.TypeDescriptor;
+import org.apache.beam.sdk.values.TypeParameter;
+
+public class BiStreamJoinResultCoder<K, V1, V2>
+    extends StructuredCoder<BiTemporalJoinResult<K, V1, V2>> {
+
+  private final Coder<V1> leftCoder;
+  private final Coder<V2> rightCoder;
+  private final Coder<K> keyCoder;
+
+  public BiStreamJoinResultCoder(Coder<K> keyCoder, Coder<V1> leftCoder, 
Coder<V2> rightCoder) {
+    this.leftCoder = NullableCoder.of(leftCoder);
+    this.rightCoder = NullableCoder.of(rightCoder);
+    this.keyCoder = NullableCoder.of(keyCoder);
+  }
+
+  public Coder<V1> getLeftCoder() {
+    return leftCoder;
+  }
+
+  public Coder<V2> getRightCoder() {
+    return rightCoder;
+  }
+
+  public Coder<K> getKeyCoder() {
+    return keyCoder;
+  }
+
+  public static <K, V1, V2> BiStreamJoinResultCoder<K, V1, V2> of(
+      Coder<K> keyCoder, Coder<V1> leftCoder, Coder<V2> rightCoder) {
+
+    return new BiStreamJoinResultCoder<>(keyCoder, leftCoder, rightCoder);
+  }
+
+  @Override
+  public void encode(BiTemporalJoinResult<K, V1, V2> value, OutputStream 
outStream)
+      throws IOException {
+
+    if (value == null) {
 
 Review comment:
   key, left and right coders are already `NullableCoder` which tolerates 
`NULL`? 
 
----------------------------------------------------------------
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: 275663)
    Time Spent: 1.5h  (was: 1h 20m)

> Add Utility BiTemporalStreamJoin
> --------------------------------
>
>                 Key: BEAM-7386
>                 URL: https://issues.apache.org/jira/browse/BEAM-7386
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-ideas
>    Affects Versions: 2.12.0
>            Reporter: Reza ardeshir rokni
>            Assignee: Reza ardeshir rokni
>            Priority: Major
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> Add utility class that enables a temporal join between two streams where 
> Stream A is matched to Stream B where
> A.timestamp = (max(b.timestamp) where b.timestamp <= a.timestamp) 
> This will use the following overall flow:
> KV(key, Timestamped<V>) 
> | Window
> | GBK
> | Statefull DoFn
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to