gianm commented on issue #7288:  AggregatorFactory.getMergingFactory() and 
getCombiningFactory() are too similar
URL: 
https://github.com/apache/incubator-druid/issues/7288#issuecomment-474106325
 
 
   I think in most (all?) cases, `foo.getCombiningFactory()` could be replaced 
by `foo.getMergingFactory(foo)`.
   
   > Even after reading Javadoc of both, I don't understand why both methods 
exist and what is the difference between them.
   
   It's not the prettiest design, but I can explain what it's for. The 
signature is `AggregatorFactory getMergingFactory(AggregatorFactory other)`. 
It's only used for one purpose: creating aggregatorFactories from segment 
metadata which can be used to query over the same column across multiple 
segments. Some example cases,
   
   - When a CompactionTask wants to compact two segments that both have a 
metric column `foo`, it uses `foo1.getMergingFactory(foo2)` to generate the 
aggregator factory that will be used to combine data from the two different 
segments.
   - When users issue a SegmentMetadata query with the "aggregators" analysis 
type and "merge" enabled (because they want to see what aggregators they should 
use at query time).
   
   It's different from `getCombiningFactory()` because it's a binary, not unary 
operation.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to