andrewbridge opened a new issue #10611: URL: https://github.com/apache/druid/issues/10611
**Druid version: 0.20.0** I'm writing a custom aggregation, using [implydata/druid-example-extension](https://github.com/implydata/druid-example-extension) as a base. I've also detailed this custom aggregation in https://github.com/apache/druid/issues/10609. The aggregation finds a value for column A, but performs the aggregation on column B. In this case, it finds the lowest/min value in column B. **Example** Given: | Column A | Column B | |----------|----------| | Foo | 5 | | Bar | 3 | | Baz | 4 | and an aggregation spec of: ```JSON { "type": "doubleMinOf", "fieldName": "Column A", "refFieldName": "Column B" } ``` The aggregation would return `Bar`, as 3 is the lowest value in Column B. ----- Given the need to store values for both column A and column B, I have opted to use a Collector/Holder pattern, similar to [`DoubleMeanHolder`](https://github.com/apache/druid/blob/master/processing/src/main/java/org/apache/druid/query/aggregation/mean/DoubleMeanHolder.java) and [`VarianceAggregatorCollector`](https://github.com/apache/druid/blob/master/extensions-core/stats/src/main/java/org/apache/druid/query/aggregation/variance/VarianceAggregatorCollector.java). This requires the use of `ValueType.COMPLEX` as an intermediary type, and since https://github.com/apache/druid/pull/9638, that also means specifying a "actual" type using [`AggregatorFactory#getComplexTypeName`](https://github.com/apache/druid/blob/master/processing/src/main/java/org/apache/druid/query/aggregation/AggregatorFactory.java#L244) and a corresponding [`ComplexMetricSerde`](https://github.com/apache/druid/blob/master/processing/src/main/java/org/apache/druid/segment/serde/ComplexMetricSerde.java). Inline documentation gets a little thin in `ComplexMetricSerde` (though it's otherwise been exceptionally helpful, thank you!), as it does in [`ComplexMetricExtractor`](https://github.com/apache/druid/blob/master/processing/src/main/java/org/apache/druid/segment/serde/ComplexMetricExtractor.java). I'm therefore unsure how I should implement a ComplexMetricSerde for my aggregation and it'd be really helpful to know: 1. How and when `ComplexMetricSerde` is used 2. How and when the `ComplexMetricExtractor` generated from [`ComplexMetricSerde#getExtractor`](https://github.com/apache/druid/blob/master/processing/src/main/java/org/apache/druid/segment/serde/ComplexMetricSerde.java#L40) is used 3. Whether the two parameter version of [`ComplexMetricExtractor#extractValue`](https://github.com/apache/druid/blob/master/processing/src/main/java/org/apache/druid/segment/serde/ComplexMetricExtractor.java#L36) is ever called directly and if it is, how best to react to such a call in my case where I need the values of two columns (which are stored by the aggregator factory, available in the three parameter version of [`ComplexMetricExtractor#extractValue`](https://github.com/apache/druid/blob/master/processing/src/main/java/org/apache/druid/segment/serde/ComplexMetricExtractor.java#L39)) ---------------------------------------------------------------- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
