com.datatorrent.lib.logs.MultiWindowDimensionAggregation 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.logs;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.validation.constraints.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.lang.mutable.MutableDouble;
import com.datatorrent.api.Context.OperatorContext;
import com.datatorrent.api.DefaultInputPort;
import com.datatorrent.api.DefaultOutputPort;
import com.datatorrent.api.Operator;
import com.datatorrent.lib.util.KeyValPair;
/**
* This class aggregates the value of given dimension across windows.
*
* @displayName Multi Window Dimension Aggregation
* @category Stats and Aggregations
* @tags aggregation
*
* @since 0.3.4
*/
public class MultiWindowDimensionAggregation implements Operator
{
@SuppressWarnings("unused")
private static final Logger logger = LoggerFactory.getLogger(MultiWindowDimensionAggregation.class);
public enum AggregateOperation
{
SUM, AVERAGE
}
private int windowSize = 2;
private int currentWindow = 0;
private String timeBucket = "m";
private String dimensionKeyVal = "0";
private List dimensionArrayString;
@NotNull
private List dimensionArray;
private AggregateOperation operationType = AggregateOperation.SUM;
private Map>> outputMap;
private Map>> cacheOject;
private transient List patternList;
private transient int applicationWindowSize = 500;
/**
* This is the output port which emits aggregated dimensions.
*/
public final transient DefaultOutputPort
© 2015 - 2025 Weber Informatics LLC | Privacy Policy