jtuglu1 commented on code in PR #18885:
URL: https://github.com/apache/druid/pull/18885#discussion_r2666463082
##########
docs/development/extensions-contrib/spectator-histogram.md:
##########
@@ -272,6 +274,134 @@ array of percentiles.
| field | A field reference pointing to the aggregated histogram. |
yes |
| percentiles | Non-empty array of decimal percentiles between 0.0 and 100.0 |
yes |
+#### Count Post-Aggregator
+
+This returns the total count of observations (data points) that were recorded
in the histogram.
+This is useful for understanding the population size without needing a
separate count metric.
+
+```json
+{
+ "type": "countSpectatorHistogram",
+ "name": "<output name>",
+ "field": {
+ "type": "fieldAccess",
+ "fieldName": "<name of aggregated SpectatorHistogram>"
+ }
+}
+```
+
+| Property | Description |
Required? |
+|----------|------------------------------------------------------------|-----------|
+| type | This String should always be "countSpectatorHistogram" | yes
|
+| name | A String for the output (result) name of the calculation. | yes
|
+| field | A field reference pointing to the aggregated histogram. | yes
|
+
+## SQL Functions
+
+In addition to the native query aggregators and post-aggregators, this
extension provides SQL functions for easier use in Druid SQL queries.
+
+### SPECTATOR_COUNT
+
+Returns the total count of observations (data points) in a Spectator histogram.
+
+**Syntax:**
+```sql
+SPECTATOR_COUNT(expr)
+```
+
+**Arguments:**
+- `expr`: A numeric column to aggregate into a histogram, or a pre-aggregated
Spectator histogram column.
+
+**Returns:** BIGINT - the total number of observations.
Review Comment:
Yes – I'll update this is a bit of native query backwards compatible
behavior that I'm trying to support. Maybe in future we can remove this to
match a signature that makes more sense.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]