code: public AggregatorFactory getMergingFactory(AggregatorFactory other) throws AggregatorFactoryNotMergeableException
    {
      final AggregatorFactory combiningFactory = this.getCombiningFactory();
      if (other.getName().equals(this.getName()) && combiningFactory.equals(other.getCombiningFactory())) {
        return combiningFactory;
      } else {
        throw new AggregatorFactoryNotMergeableException(this, other);
      }
    }
docs: Returns an AggregatorFactory that can be used to combine the output of aggregators from this factory and
  another factory. It is used when we have some values produced by this aggregator factory, and some values produced
  by the "other" aggregator factory, and we want to do some additional combining of them. This happens, for example,
  when compacting two segments together that both have a metric column with the same name. (Even though the name of
  the column is the same, the aggregator factory used to create it may be different from segment to segment.)
  
  This method may throw {@link AggregatorFactoryNotMergeableException}, meaning that "this" and "other" are not
  compatible and values from one cannot sensibly be combined with values from the other.
  
  @return a new Factory that can be used for merging the output of aggregators from this factory and other.
  
  @see #getCombiningFactory() which is equivalent to {@code foo.getMergingFactory(foo)} (when "this" and "other"
  are the same instance).