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


Java Aggregate.getAggregates方法代码示例

本文整理汇总了Java中org.apache.apex.malhar.lib.dimensions.DimensionsEvent.Aggregate.getAggregates方法的典型用法代码示例。如果您正苦于以下问题:Java Aggregate.getAggregates方法的具体用法?Java Aggregate.getAggregates怎么用?Java Aggregate.getAggregates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.apex.malhar.lib.dimensions.DimensionsEvent.Aggregate的用法示例。


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

示例1: aggregate

import org.apache.apex.malhar.lib.dimensions.DimensionsEvent.Aggregate; //导入方法依赖的package包/类
/**
 * The result keep a list of object for each aggregate value
 * The value of resultAggregate should keep a list of inputEventKey(the value can be get from cache or load) or a map
 * from inputEventKey to the value instead of just a list of aggregate value. As the value could be changed in
 * current window, and this change should be applied.
 *
 * precondition: resultAggregate.eventKey matches with inputSubEventKeys
 * notes: this algorithm only support TOP for positive values and BOTTOM for negative values
 */
@Override
public void aggregate(Aggregate resultAggregate, Set<EventKey> inputSubEventKeys,
    Map<EventKey, Aggregate> inputAggregatesRepo)
{
  //there are problem for composite's value field descriptor, just ignore now.
  GPOMutable resultGpo = resultAggregate.getAggregates();
  final List<String> compositeFieldList = resultAggregate.getEventKey().getKey().getFieldDescriptor().getFieldList();

  //Map<EventKey, Aggregate> existedSubEventKeyToAggregate = Maps.newHashMap();
  for (String valueField : resultGpo.getFieldDescriptor().getFieldList()) {
    //the resultGpo keep a list of sub aggregates
    updateAggregate(resultAggregate, valueField, inputSubEventKeys, inputAggregatesRepo);

    //compare the existed sub aggregates with the new input aggregates to update the list
    for (EventKey eventKey : inputSubEventKeys) {
      aggregate(compositeFieldList, resultGpo, eventKey, inputAggregatesRepo.get(eventKey).getAggregates());
    }
  }

}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:30,代码来源:AbstractTopBottomAggregator.java

示例2: getGroup

import org.apache.apex.malhar.lib.dimensions.DimensionsEvent.Aggregate; //导入方法依赖的package包/类
@Override
public Aggregate getGroup(InputEvent src, int aggregatorIndex)
{
  src.used = true;
  Aggregate agg = createAggregate(src,
      context,
      aggregatorIndex);

  GPOUtils.indirectCopy(agg.getAggregates(), src.getAggregates(), context.indexSubsetAggregates);

  GPOMutable metaData = new GPOMutable(getMetaDataDescriptor());

  GPOMutable fullKey = new GPOMutable(src.getKeys());

  if (context.inputTimestampIndex >= 0) {
    fullKey.getFieldsLong()[context.inputTimestampIndex] = -1L;
  }

  List<GPOMutable> keys = Lists.newArrayList(fullKey);

  GPOMutable value = new GPOMutable(agg.getAggregates());
  List<GPOMutable> values = Lists.newArrayList(value);

  metaData.getFieldsObject()[KEY_FD_INDEX] = fullKey.getFieldDescriptor();
  metaData.getFieldsObject()[AGGREGATE_FD_INDEX] = value.getFieldDescriptor();
  metaData.getFieldsObject()[KEYS_INDEX] = keys;
  metaData.getFieldsObject()[AGGREGATES_INDEX] = values;
  agg.setMetaData(metaData);

  return agg;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:32,代码来源:AggregatorCumSum.java

示例3: getGroup

import org.apache.apex.malhar.lib.dimensions.DimensionsEvent.Aggregate; //导入方法依赖的package包/类
@Override
public Aggregate getGroup(InputEvent src, int aggregatorIndex)
{
  src.used = true;
  Aggregate aggregate = createAggregate(src,
      context,
      aggregatorIndex);

  GPOMutable value = aggregate.getAggregates();
  GPOUtils.zeroFillNumeric(value);

  return aggregate;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:14,代码来源:AggregatorSum.java

示例4: aggregate

import org.apache.apex.malhar.lib.dimensions.DimensionsEvent.Aggregate; //导入方法依赖的package包/类
@Override
public void aggregate(Aggregate dest, Aggregate src)
{
  GPOMutable destAggs = dest.getAggregates();
  GPOMutable srcAggs = src.getAggregates();

  aggregateAggs(destAggs, srcAggs);
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:9,代码来源:AggregatorSum.java

示例5: setStatementParameters

import org.apache.apex.malhar.lib.dimensions.DimensionsEvent.Aggregate; //导入方法依赖的package包/类
/**
 * Sets the parameters on the {@link java.sql.PreparedStatement} based on the
 * values in the given {@link Aggregate}.
 *
 * @param aggregate
 *          The {@link Aggregate} whose values will be set on the
 *          corresponding {@link java.sql.PreparedStatement}.
 */
private void setStatementParameters(Aggregate aggregate)
{
  EventKey eventKey = aggregate.getEventKey();

  int ddID = eventKey.getDimensionDescriptorID();
  int aggID = eventKey.getAggregatorID();

  LOG.info("Setting statement params {} {}", ddID, aggID);

  FieldsDescriptor keyFD = schema.getDimensionsDescriptorIDToKeyDescriptor().get(ddID);
  FieldsDescriptor aggFD = schema.getDimensionsDescriptorIDToAggregatorIDToOutputAggregatorDescriptor().get(ddID)
      .get(aggID);

  GPOMutable key = eventKey.getKey();
  key.setFieldDescriptor(keyFD);

  GPOMutable value = aggregate.getAggregates();
  value.setFieldDescriptor(aggFD);

  int qCounter = 1;

  PreparedStatement ps = ddIDToAggIDToStatement.get(ddID).get(aggID);

  try {
    qCounter = setParams(ps, key, qCounter, true);
    setParams(ps, value, qCounter, false);
    ps.addBatch();
  } catch (SQLException ex) {
    throw new RuntimeException(ex);
  }
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:40,代码来源:JDBCDimensionalOutputOperator.java


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