[
https://issues.apache.org/jira/browse/APEXMALHAR-1701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15380192#comment-15380192
]
ASF GitHub Bot commented on APEXMALHAR-1701:
--------------------------------------------
Github user davidyan74 commented on a diff in the pull request:
https://github.com/apache/apex-malhar/pull/343#discussion_r71046708
--- Diff:
library/src/test/java/org/apache/apex/malhar/lib/dedup/WindowedDeduperTest.java
---
@@ -0,0 +1,160 @@
+/**
+ * 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.apex.malhar.lib.dedup;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Random;
+
+import org.joda.time.Duration;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import org.apache.apex.malhar.lib.window.Accumulation;
+import org.apache.apex.malhar.lib.window.Tuple;
+import org.apache.apex.malhar.lib.window.Tuple.TimestampedTuple;
+import org.apache.apex.malhar.lib.window.WindowOption;
+import org.apache.apex.malhar.lib.window.WindowState;
+import org.apache.apex.malhar.lib.window.impl.InMemoryWindowedStorage;
+
+import com.google.common.collect.Lists;
+
+import com.datatorrent.api.Context.OperatorContext;
+import com.datatorrent.lib.helper.OperatorContextTestHelper;
+import com.datatorrent.lib.testbench.CollectorTestSink;
+import com.datatorrent.lib.util.TestUtils;
+import com.datatorrent.stram.engine.WindowGenerator;
+
+public class WindowedDeduperTest
+{
+ private static final int OPERATOR_ID = 0;
+ private static AbstractWindowedDeduper<TestPojo> dedup;
+ private static final int WINDOW_SPAN = 10;
+ private static final int FIXED_WATERMARK = 30;
+
+ /**
+ * Windowed Deduper Test Implementation
+ * Tuples of type {@link TestPojo}
+ */
+ public static class WindowedDeduperImpl extends
AbstractWindowedDeduper<TestPojo>
+ {
+ @Override
+ protected Object getKey(TestPojo tuple)
+ {
+ return tuple.getKey();
+ }
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @BeforeClass
+ public static void setup()
+ {
+ dedup = new WindowedDeduperImpl();
+ // Define accumulation
+ Accumulation dedupAccum = new DedupAccumulation<TestPojo>();
+ dedup.setAccumulation(dedupAccum);
+ // Set storage to InMemory implementation
+ dedup.setDataStorage(new InMemoryWindowedStorage<List<TestPojo>>());
+ // Set retraction storage. Not used, but is required by the abstract
operator.
+ dedup.setRetractionStorage(new InMemoryWindowedStorage<TestPojo>());
--- End diff --
I see where the problem is. I have a fix here in my newest review-only PR:
#345
> Deduper : create a deduper backed by Managed State
> --------------------------------------------------
>
> Key: APEXMALHAR-1701
> URL: https://issues.apache.org/jira/browse/APEXMALHAR-1701
> Project: Apache Apex Malhar
> Issue Type: Task
> Components: algorithms
> Reporter: Chandni Singh
> Assignee: Chandni Singh
>
> Need a de-deduplicator operator that is based on Managed State.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)