com.datatorrent.api.Operator.Unifier Java Examples

The following examples show how to use com.datatorrent.api.Operator.Unifier. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Node.java    From attic-apex-core with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public static Node<?> retrieveNode(Object operator, OperatorContext context, OperatorDeployInfo.OperatorType type)
{
  logger.debug("type={}, operator class={}", type, operator.getClass());

  Node<?> node;
  if (operator instanceof InputOperator && type == OperatorDeployInfo.OperatorType.INPUT) {
    node = new InputNode((InputOperator)operator, context);
  } else if (operator instanceof Unifier && type == OperatorDeployInfo.OperatorType.UNIFIER) {
    node = new UnifierNode((Unifier<Object>)operator, context);
  } else if (type == OperatorDeployInfo.OperatorType.OIO) {
    node = new OiONode((Operator)operator, context);
  } else {
    node = new GenericNode((Operator)operator, context);
  }

  return node;
}
 
Example #2
Source File: LogicalPlan.java    From attic-apex-core with Apache License 2.0 6 votes vote down vote up
public Operator.Unifier<?> getUnifier()
{
  for (Map.Entry<OutputPort<?>, OutputPortMeta> e : operatorMeta.getPortMapping().outPortMap.entrySet()) {
    if (e.getValue() == this) {
      Unifier<?> unifier = e.getKey().getUnifier();
      if (unifier == null) {
        break;
      }
      LOG.debug("User supplied unifier is {}", unifier);
      return unifier;
    }
  }

  LOG.debug("Using default unifier for {}", this);
  return new DefaultUnifier();
}
 
Example #3
Source File: Sum.java    From attic-apex-malhar with Apache License 2.0 5 votes vote down vote up
@Override
public Unifier<Long> getUnifier()
{
  UnifierSumNumber<Long> ret = new UnifierSumNumber<Long>();
  ret.setType(Long.class);
  return ret;
}
 
Example #4
Source File: Sum.java    From attic-apex-malhar with Apache License 2.0 5 votes vote down vote up
@Override
public Unifier<Integer> getUnifier()
{
  UnifierSumNumber<Integer> ret = new UnifierSumNumber<Integer>();
  ret.setType(Integer.class);
  return ret;
}
 
Example #5
Source File: Sum.java    From attic-apex-malhar with Apache License 2.0 5 votes vote down vote up
@Override
public Unifier<Double> getUnifier()
{
  UnifierSumNumber<Double> ret = new UnifierSumNumber<Double>();
  ret.setType(Double.class);
  return ret;
}
 
Example #6
Source File: Slider.java    From attic-apex-core with Apache License 2.0 5 votes vote down vote up
public Slider(Unifier<Object> uniOperator, int buckets, int numberOfSlideBuckets)
{
  unifier = uniOperator;
  cache = new LinkedList<>();
  this.numberOfBuckets = buckets;
  this.numberOfSlideBuckets = numberOfSlideBuckets;
}
 
Example #7
Source File: TopN.java    From attic-apex-malhar with Apache License 2.0 5 votes vote down vote up
@Override
public Unifier<HashMap<K, ArrayList<V>>> getUnifier()
{
  TopN<K, V> unifier = new TopN<K, V>();
  unifier.setN(getN());
  return unifier;
}
 
Example #8
Source File: LogicalPlan.java    From attic-apex-core with Apache License 2.0 5 votes vote down vote up
public OperatorMeta getSlidingUnifier(int numberOfBuckets, int slidingApplicationWindowCount, int numberOfSlidingWindows)
{
  if (sliderMeta == null) {
    @SuppressWarnings("unchecked")
    Slider slider = new Slider((Unifier<Object>)getUnifier(), numberOfBuckets, numberOfSlidingWindows);
    try {
      sliderMeta = new OperatorMeta(operatorMeta.getName() + '.' + fieldName + "#slider", slider, getUnifierMeta().attributes.clone());
    } catch (CloneNotSupportedException ex) {
      throw new RuntimeException(ex);
    }
    sliderMeta.getAttributes().put(OperatorContext.APPLICATION_WINDOW_COUNT, slidingApplicationWindowCount);
  }
  return sliderMeta;
}
 
Example #9
Source File: Sum.java    From attic-apex-malhar with Apache License 2.0 5 votes vote down vote up
@Override
public Unifier<V> getUnifier()
{
  UnifierSumNumber<V> ret = new UnifierSumNumber<V>();
  ret.setVType(getType());
  return ret;
}
 
Example #10
Source File: Sum.java    From attic-apex-malhar with Apache License 2.0 5 votes vote down vote up
@Override
public Unifier<Short> getUnifier()
{
  UnifierSumNumber<Short> ret = new UnifierSumNumber<Short>();
  ret.setType(Short.class);
  return ret;
}
 
Example #11
Source File: OrderByOperator.java    From attic-apex-malhar with Apache License 2.0 5 votes vote down vote up
@Override
public Unifier<Map<String, Object>> getUnifier()
{
  OrderByOperator unifier = new OrderByOperator();
  for (int i = 0; i < getOrderByRules().size(); i++) {
    unifier.addOrderByRule(getOrderByRules().get(i));
  }
  unifier.setDescending(isDescending);
  return unifier;
}
 
Example #12
Source File: Sum.java    From attic-apex-malhar with Apache License 2.0 5 votes vote down vote up
@Override
public Unifier<Float> getUnifier()
{
  UnifierSumNumber<Float> ret = new UnifierSumNumber<Float>();
  ret.setType(Float.class);
  return ret;
}
 
Example #13
Source File: Max.java    From attic-apex-malhar with Apache License 2.0 4 votes vote down vote up
@Override
public Unifier<V> getUnifier()
{
  return Max.this;
}
 
Example #14
Source File: Min.java    From attic-apex-malhar with Apache License 2.0 4 votes vote down vote up
@Override
public Unifier<V> getUnifier()
{
  return Min.this;
}
 
Example #15
Source File: Counter.java    From attic-apex-malhar with Apache License 2.0 4 votes vote down vote up
@Override
public Unifier<Integer> getUnifier()
{
  return Counter.this;
}
 
Example #16
Source File: InsertSort.java    From attic-apex-malhar with Apache License 2.0 4 votes vote down vote up
@Override
public Unifier<ArrayList<K>> getUnifier()
{
  InsertSort<K> ret = new InsertSort<K>();
  return ret;
}
 
Example #17
Source File: MergeSort.java    From attic-apex-malhar with Apache License 2.0 4 votes vote down vote up
@Override
public Unifier<ArrayList<K>> getUnifier()
{
  return getUnifierInstance();
}
 
Example #18
Source File: Distinct.java    From attic-apex-malhar with Apache License 2.0 4 votes vote down vote up
@Override
public Unifier<K> getUnifier()
{
  return new Distinct<K>();
}
 
Example #19
Source File: RangeFinder.java    From examples with Apache License 2.0 4 votes vote down vote up
public Unifier<HighLow<Integer>> getUnifier() {
  return  useUnifier ? new UnifierRange<Integer>() : super.getUnifier();
}
 
Example #20
Source File: InvertIndex.java    From attic-apex-malhar with Apache License 2.0 4 votes vote down vote up
@Override
public Unifier<HashMap<V, ArrayList<K>>> getUnifier()
{
  return new InvertIndex<K, V>();
}
 
Example #21
Source File: RMin.java    From attic-apex-malhar with Apache License 2.0 4 votes vote down vote up
@Override
public Unifier<Number> getUnifier()
{
  return RMin.this;
}
 
Example #22
Source File: RMax.java    From attic-apex-malhar with Apache License 2.0 4 votes vote down vote up
@Override
public Unifier<Number> getUnifier()
{
  return RMax.this;
}
 
Example #23
Source File: UnifierNode.java    From attic-apex-core with Apache License 2.0 4 votes vote down vote up
public UnifierNode(Unifier<Object> unifier, OperatorContext context)
{
  super(unifier, context);
  this.unifier = unifier;
}
 
Example #24
Source File: Slider.java    From attic-apex-core with Apache License 2.0 4 votes vote down vote up
public Unifier<Object> getUnifier()
{
  return unifier;
}
 
Example #25
Source File: Module.java    From attic-apex-core with Apache License 2.0 4 votes vote down vote up
@Override
public Unifier<T> getUnifier()
{
  return outputPort == null ? null : outputPort.getUnifier();
}
 
Example #26
Source File: DefaultOutputPort.java    From attic-apex-core with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * Module developer can override for getUnifier functionality
 */
@Override
public Unifier<T> getUnifier()
{
  return null;
}
 
Example #27
Source File: MergeSort.java    From attic-apex-malhar with Apache License 2.0 2 votes vote down vote up
/**
 *  Get output port unifier instance, sub class should return new instance of itself.
 */
public abstract Unifier<ArrayList<K>> getUnifierInstance();