当前位置: 首页>>代码示例>>Java>>正文


Java DimensionsComputationUnifierImpl类代码示例

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


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

示例1: populateDimensionsDAG

import com.datatorrent.lib.statistics.DimensionsComputationUnifierImpl; //导入依赖的package包/类
public void populateDimensionsDAG(DAG dag, Configuration conf, DefaultOutputPort<DimensionTuple> upstreamPort) 
{
  final String eventSchema = SchemaUtils.jarResourceFileToString(eventSchemaLocation);
  
  // dimension
  DimensionsComputationFlexibleSingleSchemaPOJO dimensions = dag.addOperator("DimensionsComputation",
      DimensionsComputationFlexibleSingleSchemaPOJO.class);

  // Set operator properties
  // key expression
  {
    Map<String, String> keyToExpression = Maps.newHashMap();
    keyToExpression.put("campaignId", DimensionTuple.CAMPAIGNID);
    keyToExpression.put("time", DimensionTuple.EVENTTIME);
    dimensions.setKeyToExpression(keyToExpression);
  }

  // aggregate expression
  {
    Map<String, String> valueToExpression = Maps.newHashMap();
    valueToExpression.put("clicks", DimensionTuple.CLICKS);
    valueToExpression.put("latency", DimensionTuple.LATENCY);
    
    dimensions.setAggregateToExpression(valueToExpression);
  }

  // event schema
  dimensions.setConfigurationSchemaJSON(eventSchema);
  dimensions.setUnifier(new DimensionsComputationUnifierImpl<InputEvent, Aggregate>());

  dag.setUnifierAttribute(dimensions.output, OperatorContext.MEMORY_MB, 10240);
  
  dag.setInputPortAttribute(dimensions.input, Context.PortContext.PARTITION_PARALLEL, true);
  
  // store
  AppDataSingleSchemaDimensionStoreHDHT store = createStore(dag, conf, eventSchema); 
  store.setCacheWindowDuration(10000 * 5 / STREAMING_WINDOW_SIZE_MILLIS);   //cache for 5 windows
  dag.addStream("GenerateStream", upstreamPort, dimensions.input).setLocality(Locality.CONTAINER_LOCAL);
  
  StoreStreamCodec codec = new StoreStreamCodec();
  dag.setInputPortAttribute(store.input, PortContext.STREAM_CODEC, codec);
  dag.addStream("DimensionalStream", dimensions.output, store.input);

  
  if (includeQuery) {
    createQuery(dag, conf, store);

    // wsOut
    PubSubWebSocketAppDataResult wsOut = createQueryResult(dag, conf, store);

    dag.addStream("QueryResult", store.queryResult, wsOut.input);
  } else {
    DevNull devNull = new DevNull();
    dag.addOperator("devNull", devNull);
    dag.addStream("QueryResult", store.queryResult, devNull.data);
  }
  
  dag.setAttribute(DAGContext.STREAMING_WINDOW_SIZE_MILLIS, STREAMING_WINDOW_SIZE_MILLIS);
}
 
开发者ID:yahoo,项目名称:streaming-benchmarks,代码行数:60,代码来源:ApplicationDimensionComputation.java

示例2: getUnifier

import com.datatorrent.lib.statistics.DimensionsComputationUnifierImpl; //导入依赖的package包/类
/**
 * Gets the unifier set on this operator.
 *
 * @return The unifier set on this operator.
 */
public DimensionsComputationUnifierImpl<InputEvent, Aggregate> getUnifier()
{
  return unifier;
}
 
开发者ID:DataTorrent,项目名称:Megh,代码行数:10,代码来源:AbstractDimensionsComputationFlexibleSingleSchema.java

示例3: setUnifier

import com.datatorrent.lib.statistics.DimensionsComputationUnifierImpl; //导入依赖的package包/类
/**
 * Sets the unifier on this operator.
 *
 * @param unifier The unifier set on this operator.
 */
public void setUnifier(DimensionsComputationUnifierImpl<InputEvent, Aggregate> unifier)
{
  this.unifier = unifier;
}
 
开发者ID:DataTorrent,项目名称:Megh,代码行数:10,代码来源:AbstractDimensionsComputationFlexibleSingleSchema.java


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