Search in sources :

Example 1 with TimeSpec

use of com.linkedin.thirdeye.hadoop.config.TimeSpec in project pinot by linkedin.

the class ThirdEyeConfig method getInputTimeFromProperties.

private static TimeSpec getInputTimeFromProperties(Properties props) {
    TimeSpec inputTime = null;
    String timeColumnName = getAndCheck(props, ThirdEyeConfigProperties.THIRDEYE_TIMECOLUMN_NAME.toString());
    String timeColumnType = getAndCheck(props, ThirdEyeConfigProperties.THIRDEYE_INPUT_TIMECOLUMN_TYPE.toString(), null);
    String timeColumnSize = getAndCheck(props, ThirdEyeConfigProperties.THIRDEYE_INPUT_TIMECOLUMN_SIZE.toString(), null);
    String timeFormat = getAndCheck(props, ThirdEyeConfigProperties.THIRDEYE_INPUT_TIMECOLUMN_FORMAT.toString(), DEFAULT_TIME_FORMAT);
    if (timeColumnType != null && timeColumnSize != null) {
        TimeGranularity timeGranularity = new TimeGranularity(Integer.parseInt(timeColumnSize), TimeUnit.valueOf(timeColumnType));
        inputTime = new TimeSpec(timeColumnName, timeGranularity, timeFormat);
    }
    return inputTime;
}
Also used : TimeGranularity(com.linkedin.thirdeye.hadoop.config.TimeGranularity) TimeSpec(com.linkedin.thirdeye.hadoop.config.TimeSpec)

Example 2 with TimeSpec

use of com.linkedin.thirdeye.hadoop.config.TimeSpec in project pinot by linkedin.

the class AggregationPhaseConfig method fromThirdEyeConfig.

public static AggregationPhaseConfig fromThirdEyeConfig(ThirdEyeConfig config) {
    // metrics
    List<String> metricNames = new ArrayList<String>(config.getMetrics().size());
    List<MetricType> metricTypes = new ArrayList<MetricType>(config.getMetrics().size());
    for (MetricSpec spec : config.getMetrics()) {
        metricNames.add(spec.getName());
        metricTypes.add(spec.getType());
    }
    // dimensions
    List<String> dimensionNames = new ArrayList<String>(config.getDimensions().size());
    for (DimensionSpec dimensionSpec : config.getDimensions()) {
        dimensionNames.add(dimensionSpec.getName());
    }
    // time
    TimeSpec time = config.getTime();
    // input time
    TimeSpec inputTime = config.getInputTime();
    if (inputTime == null) {
        throw new IllegalStateException("Must provide input time configs for aggregation job");
    }
    return new AggregationPhaseConfig(dimensionNames, metricNames, metricTypes, time, inputTime);
}
Also used : DimensionSpec(com.linkedin.thirdeye.hadoop.config.DimensionSpec) MetricType(com.linkedin.thirdeye.hadoop.config.MetricType) MetricSpec(com.linkedin.thirdeye.hadoop.config.MetricSpec) ArrayList(java.util.ArrayList) TimeSpec(com.linkedin.thirdeye.hadoop.config.TimeSpec)

Example 3 with TimeSpec

use of com.linkedin.thirdeye.hadoop.config.TimeSpec in project pinot by linkedin.

the class ThirdEyeConfig method getTimeFromProperties.

private static TimeSpec getTimeFromProperties(Properties props) {
    String timeColumnName = getAndCheck(props, ThirdEyeConfigProperties.THIRDEYE_TIMECOLUMN_NAME.toString());
    String timeColumnType = getAndCheck(props, ThirdEyeConfigProperties.THIRDEYE_TIMECOLUMN_TYPE.toString(), DEFAULT_TIME_TYPE);
    String timeColumnSize = getAndCheck(props, ThirdEyeConfigProperties.THIRDEYE_TIMECOLUMN_SIZE.toString(), DEFAULT_TIME_SIZE);
    TimeGranularity timeGranularity = new TimeGranularity(Integer.parseInt(timeColumnSize), TimeUnit.valueOf(timeColumnType));
    String timeFormat = getAndCheck(props, ThirdEyeConfigProperties.THIRDEYE_TIMECOLUMN_FORMAT.toString(), DEFAULT_TIME_FORMAT);
    TimeSpec time = new TimeSpec(timeColumnName, timeGranularity, timeFormat);
    return time;
}
Also used : TimeGranularity(com.linkedin.thirdeye.hadoop.config.TimeGranularity) TimeSpec(com.linkedin.thirdeye.hadoop.config.TimeSpec)

Example 4 with TimeSpec

use of com.linkedin.thirdeye.hadoop.config.TimeSpec in project pinot by linkedin.

the class ThirdEyeConfig method fromProperties.

/**
   * Creates a ThirdEyeConfig object from the Properties object
   * @param props
   * @return
   */
public static ThirdEyeConfig fromProperties(Properties props) {
    String collection = getCollectionFromProperties(props);
    List<DimensionSpec> dimensions = getDimensionFromProperties(props);
    List<MetricSpec> metrics = getMetricsFromProperties(props);
    TimeSpec inputTime = getInputTimeFromProperties(props);
    TimeSpec time = getTimeFromProperties(props);
    SplitSpec split = getSplitFromProperties(props);
    TopkWhitelistSpec topKWhitelist = getTopKWhitelistFromProperties(props);
    ThirdEyeConfig thirdeyeConfig = new ThirdEyeConfig(collection, dimensions, metrics, inputTime, time, topKWhitelist, split);
    return thirdeyeConfig;
}
Also used : DimensionSpec(com.linkedin.thirdeye.hadoop.config.DimensionSpec) TopkWhitelistSpec(com.linkedin.thirdeye.hadoop.config.TopkWhitelistSpec) MetricSpec(com.linkedin.thirdeye.hadoop.config.MetricSpec) SplitSpec(com.linkedin.thirdeye.hadoop.config.SplitSpec) TimeSpec(com.linkedin.thirdeye.hadoop.config.TimeSpec)

Aggregations

TimeSpec (com.linkedin.thirdeye.hadoop.config.TimeSpec)4 DimensionSpec (com.linkedin.thirdeye.hadoop.config.DimensionSpec)2 MetricSpec (com.linkedin.thirdeye.hadoop.config.MetricSpec)2 TimeGranularity (com.linkedin.thirdeye.hadoop.config.TimeGranularity)2 MetricType (com.linkedin.thirdeye.hadoop.config.MetricType)1 SplitSpec (com.linkedin.thirdeye.hadoop.config.SplitSpec)1 TopkWhitelistSpec (com.linkedin.thirdeye.hadoop.config.TopkWhitelistSpec)1 ArrayList (java.util.ArrayList)1