本文整理汇总了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);
}
示例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;
}
示例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;
}