• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Granularity类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.metamx.common.Granularity的典型用法代码示例。如果您正苦于以下问题:Java Granularity类的具体用法?Java Granularity怎么用?Java Granularity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Granularity类属于com.metamx.common包,在下文中一共展示了Granularity类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: bucketMonthComparator

import com.metamx.common.Granularity; //导入依赖的package包/类
public static Comparator<DataSegment> bucketMonthComparator()
{
  return new Comparator<DataSegment>()
  {
    @Override
    public int compare(DataSegment lhs, DataSegment rhs)
    {
      int retVal;

      DateTime lhsMonth = Granularity.MONTH.truncate(lhs.getInterval().getStart());
      DateTime rhsMonth = Granularity.MONTH.truncate(rhs.getInterval().getStart());

      retVal = lhsMonth.compareTo(rhsMonth);

      if (retVal != 0) {
        return retVal;
      }

      return lhs.compareTo(rhs);
    }
  };
}
 
开发者ID:druid-io,项目名称:druid-api,代码行数:23,代码来源:DataSegment.java


示例2: configure

import com.metamx.common.Granularity; //导入依赖的package包/类
@Override
public void configure(Context context) {

    indexService = context.getString(INDEX_SERVICE);
    discoveryPath = context.getString(DISCOVERY_PATH);
    dimensions = Arrays.asList(context.getString(DIMENSIONS).split(","));
    firehosePattern = context.getString(FIREHOSE_PATTERN, DEFAULT_FIREHOSE);
    dataSource = context.getString(DATA_SOURCE, DEFAUL_DATASOURCE);
    aggregators = AggregatorsHelper.build(context.getString(AGGREGATORS));
    queryGranularity = QueryGranularityHelper.getGranularity(context.getString(QUERY_GRANULARITY,
            DEFAULT_QUERY_GRANULARITY));
    segmentGranularity = Granularity.valueOf(context.getString(SEGMENT_GRANULARITY, DEFAULT_SEGMENT_GRANULARITY));
    period = context.getString(WINDOW_PERIOD, DEFAULT_PERIOD);
    partitions = context.getInteger(PARTITIONS, DEFAULT_PARTITIONS);
    replicants = context.getInteger(REPLICANTS, DEFAULT_REPLICANTS);
    // Tranquility needs to be able to extract timestamps from your object type (in this case, Map<String, Object>).
    timestampField = context.getString(TIMESTAMP_FIELD, DEFAULT_TIMESTAMP_FIELD);
    zookeeperLocation = context.getString(ZOOKEEPER_LOCATION, DEFAULT_ZOOKEEPER_LOCATION);
    baseSleppTime = context.getInteger(ZOOKEEPPER_BASE_SLEEP_TIME, DEFAULT_ZOOKEEPER_BASE_SLEEP);
    maxRetries = context.getInteger(ZOOKEEPER_MAX_RETRIES, DEFAULT_ZOOKEEPER_MAX_RETRIES);
    maxSleep = context.getInteger(ZOOKEEPER_MAX_SLEEP, DEFAULT_ZOOKEEPER_MAX_SLEEP);
    batchSize = context.getInteger(BATCH_SIZE, DEFAULT_BATCH_SIZE);

    druidService = buildDruidService();
    sinkCounter = new SinkCounter(this.getName());
    eventParser = new EventParser(timestampField);
}
 
开发者ID:Stratio,项目名称:ingestion,代码行数:28,代码来源:DruidSink.java


示例3: configure

import com.metamx.common.Granularity; //导入依赖的package包/类
@Override
public void configure(Context context) {
    indexService = context.getString(INDEX_SERVICE);
    discoveryPath = context.getString(DISCOVERY_PATH);
    dimensions = Arrays.asList(context.getString(DIMENSIONS).split(","));
    firehosePattern = context.getString(FIREHOSE_PATTERN, DEFAULT_FIREHOSE);
    dataSource = context.getString(DATA_SOURCE, DEFAUL_DATASOURCE);
    aggregators = AggregatorsHelper.build(context.getString(AGGREGATORS));
    queryGranularity = QueryGranularity.fromString(context.getString(QUERY_GRANULARITY, DEFAULT_QUERY_GRANULARITY));
    segmentGranularity = Granularity.valueOf(context.getString(SEGMENT_GRANULARITY, DEFAULT_SEGMENT_GRANULARITY));
    windowPeriod = context.getString(WINDOW_PERIOD, DEFAULT_PERIOD);
    partitions = context.getInteger(PARTITIONS, DEFAULT_PARTITIONS);
    replicants = context.getInteger(REPLICANTS, DEFAULT_REPLICANTS);
    timestampField = context.getString(TIMESTAMP_FIELD, DEFAULT_TIMESTAMP_FIELD);
    timestampFormat = context.getString(TIMESTAMP_FORMAT, null);
    zookeeperLocation = context.getString(ZOOKEEPER_LOCATION, DEFAULT_ZOOKEEPER_LOCATION);
    baseSleepTime = context.getInteger(ZOOKEEPPER_BASE_SLEEP_TIME, DEFAULT_ZOOKEEPER_BASE_SLEEP);
    maxRetries = context.getInteger(ZOOKEEPER_MAX_RETRIES, DEFAULT_ZOOKEEPER_MAX_RETRIES);
    maxSleep = context.getInteger(ZOOKEEPER_MAX_SLEEP, DEFAULT_ZOOKEEPER_MAX_SLEEP);
    batchSize = context.getInteger(BATCH_SIZE, DEFAULT_BATCH_SIZE);

    druidService = sinkStrategy.getDruidService();
    if (druidService != null) {
        sinkCounter = new SinkCounter(this.getName());
        if (timestampFormat.equals("auto"))
            dateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss'Z'");
        else if (timestampFormat.equals("millis"))
            dateTimeFormatter = null;
        else
            dateTimeFormatter = DateTimeFormat.forPattern(timestampFormat);

        // Filter defined fields
        Set<String> filter = new HashSet<String>();
        filter.add(timestampField);
        filter.addAll(dimensions);
        for (AggregatorFactory aggregatorFactory : aggregators) {
            filter.addAll(aggregatorFactory.requiredFields());
        }

        eventParser = new FlumeEventParser(timestampField, dateTimeFormatter, filter);
    }
}
 
开发者ID:KonkerLabs,项目名称:flume-ng-druid-sink,代码行数:43,代码来源:TranquilitySink.java


示例4: getSegmentGranularity

import com.metamx.common.Granularity; //导入依赖的package包/类
private Granularity getSegmentGranularity() {
    Granularity granularity = Granularity.HOUR;

    switch (segmentGranularity) {
        case "SECOND":
            granularity = Granularity.SECOND;
            break;
        case "MINUTE":
            granularity = Granularity.MINUTE;
            break;
        case "FIVE_MINUTE":
            granularity = Granularity.FIVE_MINUTE;
            break;
        case "TEN_MINUTE":
            granularity = Granularity.TEN_MINUTE;
            break;
        case "FIFTEEN_MINUTE":
            granularity = Granularity.FIFTEEN_MINUTE;
            break;
        case "HOUR":
            granularity = Granularity.HOUR;
            break;
        case "SIX_HOUR":
            granularity = Granularity.SIX_HOUR;
            break;
        case "DAY":
            granularity = Granularity.DAY;
            break;
        case "WEEK":
            granularity = Granularity.WEEK;
            break;
        case "MONTH":
            granularity = Granularity.MONTH;
            break;
        case "YEAR":
            granularity = Granularity.YEAR;
            break;
        default:
            break;
    }
    return granularity;
}
 
开发者ID:hortonworks,项目名称:streamline,代码行数:43,代码来源:DruidBeamFactoryImpl.java



注:本文中的com.metamx.common.Granularity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GtfsReader类代码示例发布时间:2022-05-23
下一篇:
Java FinalizablePhantomReference类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap