com.datatorrent.lib.algo.DistinctMap Maven / Gradle / Ivy
/**
* 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 com.datatorrent.lib.algo;
import java.util.HashMap;
import java.util.Map;
import com.datatorrent.api.DefaultInputPort;
import com.datatorrent.api.DefaultOutputPort;
import com.datatorrent.api.annotation.OperatorAnnotation;
import com.datatorrent.lib.util.BaseKeyValueOperator;
import com.datatorrent.lib.util.UnifierHashMap;
/**
* This operator computes and emits distinct key,val pairs (i.e drops duplicates).
*
* Computes and emits distinct key,val pairs (i.e drops duplicates)
*
*
* This is a pass through operator
*
* This module is same as a "FirstOf" metric on any key,val pair. At end of window all data is flushed.
*
* StateFull : Yes, tuple are compare across application window(s).
* Partitions : Yes, distinct output is unified by unifier hash map operator.
*
* Ports:
* data: Input data port expects Map<K,V>
* distinct: Output data port, emits HashMap<K,V>(1)
*
*
*
* @displayName Distinct Key Value Merge
* @category Stream Manipulators
* @tags filter, unique, key value
*
* @since 0.3.2
*/
@OperatorAnnotation(partitionable = true)
public class DistinctMap extends BaseKeyValueOperator
{
/**
* The input port on which key value pairs are received.
*/
public final transient DefaultInputPort
© 2015 - 2025 Weber Informatics LLC | Privacy Policy