[
https://issues.apache.org/jira/browse/BEAM-7386?focusedWorklogId=293688&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-293688
]
ASF GitHub Bot logged work on BEAM-7386:
----------------------------------------
Author: ASF GitHub Bot
Created on: 13/Aug/19 07:32
Start Date: 13/Aug/19 07:32
Worklog Time Spent: 10m
Work Description: rezarokni commented on pull request #9032: [BEAM-7386]
Bi-Temporal Join
URL: https://github.com/apache/beam/pull/9032#discussion_r313254684
##########
File path:
sdks/java/extensions/timeseries/src/main/java/org/apache/beam/sdk/extensions/timeseries/joins/BiTemporalStreams.java
##########
@@ -0,0 +1,462 @@
+/*
+ * 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.util.*;
+import org.apache.beam.sdk.annotations.Experimental;
+import org.apache.beam.sdk.coders.Coder;
+import org.apache.beam.sdk.coders.KvCoder;
+import org.apache.beam.sdk.coders.VarLongCoder;
+import org.apache.beam.sdk.state.*;
+import org.apache.beam.sdk.state.Timer;
+import org.apache.beam.sdk.transforms.DoFn;
+import org.apache.beam.sdk.transforms.Flatten;
+import org.apache.beam.sdk.transforms.PTransform;
+import org.apache.beam.sdk.transforms.ParDo;
+import org.apache.beam.sdk.transforms.join.KeyedPCollectionTuple;
+import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
+import org.apache.beam.sdk.transforms.windowing.FixedWindows;
+import org.apache.beam.sdk.transforms.windowing.PaneInfo;
+import org.apache.beam.sdk.transforms.windowing.Window;
+import org.apache.beam.sdk.util.WindowedValue;
+import org.apache.beam.sdk.values.*;
+import org.joda.time.Duration;
+import org.joda.time.Instant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This sample will take two streams left stream and right stream. It will
match the left stream to
+ * the nearest right stream based on their timestamp. Nearest left stream is
either <= to the right
+ * stream timestamp.
+ *
+ * <p>If two values in the right steam have the same timestamp then the
results are
+ * non-deterministic.
+ */
+@Experimental
+public class BiTemporalStreams {
+
+ public static <K, V1, V2> BiTemporalJoin<K, V1, V2> join(
+ TupleTag<V1> leftTag, TupleTag<V2> rightTag, Duration window) {
+ return new BiTemporalJoin<>(leftTag, rightTag, window);
+ }
+
+ @Experimental
+ public static class BiTemporalJoin<K, V1, V2>
+ extends PTransform<KeyedPCollectionTuple<K>,
PCollection<BiTemporalJoinResult<K, V1, V2>>> {
+
+ private static final Logger LOG =
LoggerFactory.getLogger(BiTemporalStreams.class);
+
+ // Sets the limit at which point the processed left stream values are
garbage collected
+ static int GC_LIMIT = 1000;
Review comment:
Looks like one of the keys is no longer getting processed. Thats the
symptom, digging into the cause.
----------------------------------------------------------------
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: 293688)
Time Spent: 5h 20m (was: 5h 10m)
> 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: 5h 20m
> 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)