[
https://issues.apache.org/jira/browse/BEAM-10114?focusedWorklogId=441836&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-441836
]
ASF GitHub Bot logged work on BEAM-10114:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 05/Jun/20 14:38
Start Date: 05/Jun/20 14:38
Worklog Time Spent: 10m
Work Description: steveniemitz commented on a change in pull request
#11919:
URL: https://github.com/apache/beam/pull/11919#discussion_r435965759
##########
File path:
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsublite/DeduplicationFn.java
##########
@@ -0,0 +1,111 @@
+/*
+ * 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.io.gcp.pubsublite;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import org.apache.beam.sdk.coders.Coder;
+import org.apache.beam.sdk.coders.DelegateCoder;
+import org.apache.beam.sdk.coders.InstantCoder;
+import org.apache.beam.sdk.coders.ListCoder;
+import org.apache.beam.sdk.coders.MapCoder;
+import org.apache.beam.sdk.state.SetState;
+import org.apache.beam.sdk.state.StateSpec;
+import org.apache.beam.sdk.state.StateSpecs;
+import org.apache.beam.sdk.state.ValueState;
+import org.apache.beam.sdk.transforms.DoFn;
+import org.apache.beam.sdk.values.KV;
+import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Lists;
+import org.joda.time.Instant;
+
+// A DeduplicationFn takes a KV from a hashed version of KeyT to a KV of KeyT
and ValueT and
+// deduplicates based on KeyT. KeyT must provide a non-identity implementation
of equals.
+class DeduplicationFn<KeyT, ValueT> extends DoFn<KV<Integer, KV<KeyT,
ValueT>>, KV<KeyT, ValueT>> {
+ private final DeduplicationFnOptions<KeyT> options;
+
+ // A state cell holding the set of recently received keys.
+ @SuppressWarnings("unused")
+ @StateId("keySet")
+ private final StateSpec<SetState<KeyT>> keySetSpec;
Review comment:
this will fail on dataflow, it doesn't support SetState or MapState yet.
Dataflow does have its own deduplicate implementation [1] that pushes the work
to windmill's own exactly-once impl, you might be able to override this
transform w/ that in the runner? There's also a Deduplicate transform [2] in
beam now, but I don't think it'd scale very well.
[1]
https://github.com/apache/beam/blob/8aedab2da96e1324f8433df3c772d59346f825b4/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/DataflowRunner.java#L1729
[2]
https://github.com/apache/beam/blob/8aedab2da96e1324f8433df3c772d59346f825b4/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Deduplicate.java
----------------------------------------------------------------
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: 441836)
Time Spent: 0.5h (was: 20m)
> Add Pub/Sub Lite IO to beam builtin
> -----------------------------------
>
> Key: BEAM-10114
> URL: https://issues.apache.org/jira/browse/BEAM-10114
> Project: Beam
> Issue Type: New Feature
> Components: io-java-gcp
> Reporter: Daniel Collins
> Priority: P2
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> The IO currently lives [on the pubsub lite
> github|[https://github.com/googleapis/java-pubsublite/tree/master/pubsublite-beam-io]]
> but should be moved to being part of beam.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)