hfukada commented on code in PR #15049:
URL: https://github.com/apache/druid/pull/15049#discussion_r1443876647


##########
docs/development/extensions-contrib/ddsketch-quantiles.md:
##########
@@ -0,0 +1,133 @@
+---
+id: ddsketch-quantiles
+title: "DDSketches for Approximate Quantiles module"
+---
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+
+This module provides aggregators for approximate quantile queries using the 
[DDSketch](https://github.com/datadog/sketches-java) library. The DDSketch 
library provides a fast, and fully-mergeable quantile sketch with relative 
error. If the true quantile is 100, a sketch with relative error of 1% 
guarantees a quantile value between 101 and 99. This is important and highly 
valuable behavior for long tail distributions. The best use case for these 
sketches is for accurately describing the upper quantiles of long tailed 
distributions such as network latencies.
+
+To use this Apache Druid extension, 
[include](../../configuration/extensions.md#loading-extensions) in the 
extensions load list.
+
+```
+druid.extensions.loadList=["druid-ddsketch", ...]
+```
+
+### Aggregator
+
+The result of the aggregation is a DDSketch that is the union of all sketches 
either built from raw data or read from the segments. The single number that is 
returned represents the total number of included data points. The default 
aggregator type of `ddSketch` uses the collapsingLowestDense strategy for 
storing and merging sketch. This means that in favor of keeping the highest 
values represented at the highest accuracy, the sketch will collapse and merge 
lower, smaller values in the sketch. Collapsed bins will lose accuracy 
guarantees. The default number of bins is 1000. Sketches can only be merged 
when using the same relativeError values.
+
+The `ddSketch` aggregator operates over raw data and precomputed sketches.
+
+```json
+{
+  "type" : "ddSketch",
+  "name" : <output_name>,
+  "fieldName" : <input_name>,
+  "relativeError" : <double(0, 1)>,
+  "numBins": <int>
+ }
+```
+
+|property|description|required?|
+|--------|-----------|---------|
+|type|Must be "ddSketch" |yes|
+|name|A String for the output (result) name of the calculation.|yes|
+|fieldName|A String for the name of the input field (can contain sketches or 
raw numeric values).|yes|
+|relativeError||Describes the precision in which to store the sketch. Must be 
a number between 0 and 1.|no, defaults to 0.01 (1% error)|
+|numBins|Total number of bins the sketch is allowed to use to describe the 
distribution. This has a direct impact on max memory used. The more total bins 
available, the larger the range of accurate quantiles.* |no, defaults to 1000|
+
+* Examples Tuning: With relative accuracy of 2%, only 275 bins are required to 
cover values between 1 millisecond and 1 minute. 800 bins are required to cover 
values between 1 nanosecond and 1 day.

Review Comment:
   moved into the table :+1: 



-- 
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]

Reply via email to