blob: 093bab017df49920a78304851f7b2a1dd6d58816 [file] [log] [blame]
<!doctype html>
<html lang="en" dir="ltr" class="docs-wrapper docs-doc-page docs-version-current plugin-docs plugin-id-default docs-doc-id-development/extensions-core/approximate-histograms">
<head>
<meta charset="UTF-8">
<meta name="generator" content="Docusaurus v2.4.1">
<title data-rh="true">Approximate Histogram aggregators | Apache® Druid</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:image" content="https://druid.apache.org/img/druid_nav.png"><meta data-rh="true" name="twitter:image" content="https://druid.apache.org/img/druid_nav.png"><meta data-rh="true" property="og:url" content="https://druid.apache.org/docs/latest/development/extensions-core/approximate-histograms"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="Approximate Histogram aggregators | Apache® Druid"><meta data-rh="true" name="description" content="&lt;!--"><meta data-rh="true" property="og:description" content="&lt;!--"><link data-rh="true" rel="icon" href="/img/favicon.png"><link data-rh="true" rel="canonical" href="https://druid.apache.org/docs/latest/development/extensions-core/approximate-histograms"><link data-rh="true" rel="alternate" href="https://druid.apache.org/docs/latest/development/extensions-core/approximate-histograms" hreflang="en"><link data-rh="true" rel="alternate" href="https://druid.apache.org/docs/latest/development/extensions-core/approximate-histograms" hreflang="x-default"><link rel="preconnect" href="https://www.google-analytics.com">
<link rel="preconnect" href="https://www.googletagmanager.com">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-131010415-1"></script>
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","UA-131010415-1",{})</script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js"></script><link rel="stylesheet" href="/assets/css/styles.f80751b3.css">
<link rel="preload" href="/assets/js/runtime~main.dc5f839a.js" as="script">
<link rel="preload" href="/assets/js/main.a03dfc13.js" as="script">
</head>
<body class="navigation-with-keyboard">
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}return t}()||function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top navbar--dark"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="/img/druid_nav.png" alt="Apache® Druid" class="themedImage_ToTc themedImage--light_HNdA"><img src="/img/druid_nav.png" alt="Apache® Druid" class="themedImage_ToTc themedImage--dark_i4oU"></div></a></div><div class="navbar__items navbar__items--right"><a class="navbar__item navbar__link" href="/technology">Technology</a><a class="navbar__item navbar__link" href="/use-cases">Use Cases</a><a class="navbar__item navbar__link" href="/druid-powered">Powered By</a><a class="navbar__item navbar__link" href="/docs/latest/design/">Docs</a><a class="navbar__item navbar__link" href="/community/">Community</a><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">Apache®</a><ul class="dropdown__menu"><li><a href="https://www.apache.org/" target="_blank" rel="noopener noreferrer" class="dropdown__link">Foundation<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://apachecon.com/?ref=druid.apache.org" target="_blank" rel="noopener noreferrer" class="dropdown__link">Events<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/licenses/" target="_blank" rel="noopener noreferrer" class="dropdown__link">License<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/foundation/thanks.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">Thanks<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/security/" target="_blank" rel="noopener noreferrer" class="dropdown__link">Security<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/foundation/sponsorship.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">Sponsorship<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><a class="navbar__item navbar__link" href="/downloads/">Download</a><div class="searchBox_ZlJk"><div class="navbar__search"><span aria-label="expand searchbar" role="button" class="search-icon" tabindex="0"></span><input type="search" id="search_input_react" placeholder="Loading..." aria-label="Search" class="navbar__search-input search-bar" disabled=""></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Approximate Histogram aggregators</h1></header><p>To use this Apache Druid extension, <a href="/docs/latest/configuration/extensions#loading-extensions">include</a> <code>druid-histogram</code> in the extensions load list.</p><p>The <code>druid-histogram</code> extension provides an approximate histogram aggregator and a fixed buckets histogram aggregator.</p><a name="approximate-histogram-aggregator"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="approximate-histogram-aggregator-deprecated">Approximate Histogram aggregator (Deprecated)<a href="#approximate-histogram-aggregator-deprecated" class="hash-link" aria-label="Direct link to Approximate Histogram aggregator (Deprecated)" title="Direct link to Approximate Histogram aggregator (Deprecated)"></a></h2><div class="theme-admonition theme-admonition-info alert alert--info admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>info</div><div class="admonitionContent_S0QG"><p> The Approximate Histogram aggregator is deprecated. Please use <a href="/docs/latest/development/extensions-core/datasketches-quantiles">DataSketches Quantiles</a> instead which provides a superior distribution-independent algorithm with formal error guarantees.</p></div></div><p>This aggregator is based on
<a href="http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf" target="_blank" rel="noopener noreferrer">http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf</a>
to compute approximate histograms, with the following modifications:</p><ul><li>some tradeoffs in accuracy were made in the interest of speed (see below)</li><li>the sketch maintains the exact original data as long as the number of
distinct data points is fewer than the resolutions (number of centroids),
increasing accuracy when there are few data points, or when dealing with
discrete data points. You can find some of the details in <a href="https://metamarkets.com/2013/histograms/" target="_blank" rel="noopener noreferrer">this post</a>.</li></ul><p>Here are a few things to note before using approximate histograms:</p><ul><li>As indicated in the original paper, there are no formal error bounds on the
approximation. In practice, the approximation gets worse if the distribution
is skewed.</li><li>The algorithm is order-dependent, so results can vary for the same query, due
to variations in the order in which results are merged.</li><li>In general, the algorithm only works well if the data that comes is randomly
distributed (i.e. if data points end up sorted in a column, approximation
will be horrible)</li><li>We traded accuracy for aggregation speed, taking some shortcuts when adding
histograms together, which can lead to pathological cases if your data is
ordered in some way, or if your distribution has long tails. It should be
cheaper to increase the resolution of the sketch to get the accuracy you need.</li></ul><p>That being said, those sketches can be useful to get a first order approximation
when averages are not good enough. Assuming most rows in your segment store
fewer data points than the resolution of histogram, you should be able to use
them for monitoring purposes and detect meaningful variations with a few
hundred centroids. To get good accuracy readings on 95th percentiles with
millions of rows of data, you may want to use several thousand centroids,
especially with long tails, since that&#x27;s where the approximation will be worse.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="creating-approximate-histogram-sketches-at-ingestion-time">Creating approximate histogram sketches at ingestion time<a href="#creating-approximate-histogram-sketches-at-ingestion-time" class="hash-link" aria-label="Direct link to Creating approximate histogram sketches at ingestion time" title="Direct link to Creating approximate histogram sketches at ingestion time"></a></h3><p>To use this feature, an &quot;approxHistogram&quot; or &quot;approxHistogramFold&quot; aggregator must be included at
indexing time. The ingestion aggregator can only apply to numeric values. If you use &quot;approxHistogram&quot;
then any input rows missing the value will be considered to have a value of 0, while with &quot;approxHistogramFold&quot;
such rows will be ignored.</p><p>To query for results, an &quot;approxHistogramFold&quot; aggregator must be included in the
query.</p><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;type&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;approxHistogram or approxHistogramFold (at ingestion time), approxHistogramFold (at query time)&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;name&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;output_name&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;fieldName&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;metric_name&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;resolution&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;integer&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;numBuckets&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;integer&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;lowerLimit&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;float&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;upperLimit&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;float&gt;</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><table><thead><tr><th>Property</th><th>Description</th><th>Default</th></tr></thead><tbody><tr><td><code>resolution</code></td><td>Number of centroids (data points) to store. The higher the resolution, the more accurate results are, but the slower the computation will be.</td><td>50</td></tr><tr><td><code>numBuckets</code></td><td>Number of output buckets for the resulting histogram. Bucket intervals are dynamic, based on the range of the underlying data. Use a post-aggregator to have finer control over the bucketing scheme</td><td>7</td></tr><tr><td><code>lowerLimit</code>/<code>upperLimit</code></td><td>Restrict the approximation to the given range. The values outside this range will be aggregated into two centroids. Counts of values outside this range are still maintained.</td><td>-INF/+INF</td></tr><tr><td><code>finalizeAsBase64Binary</code></td><td>If true, the finalized aggregator value will be a Base64-encoded byte array containing the serialized form of the histogram. If false, the finalized aggregator value will be a JSON representation of the histogram.</td><td>false</td></tr></tbody></table><h2 class="anchor anchorWithStickyNavbar_LWe7" id="fixed-buckets-histogram">Fixed Buckets Histogram<a href="#fixed-buckets-histogram" class="hash-link" aria-label="Direct link to Fixed Buckets Histogram" title="Direct link to Fixed Buckets Histogram"></a></h2><p>The fixed buckets histogram aggregator builds a histogram on a numeric column, with evenly-sized buckets across a specified value range. Values outside of the range are handled based on a user-specified outlier handling mode.</p><p>This histogram supports the min/max/quantiles post-aggregators but does not support the bucketing post-aggregators.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="when-to-use">When to use<a href="#when-to-use" class="hash-link" aria-label="Direct link to When to use" title="Direct link to When to use"></a></h3><p>The accuracy/usefulness of the fixed buckets histogram is extremely data-dependent; it is provided to support special use cases where the user has a great deal of prior information about the data being aggregated and knows that a fixed buckets implementation is suitable.</p><p>For general histogram and quantile use cases, the <a href="/docs/latest/development/extensions-core/datasketches-quantiles">DataSketches Quantiles Sketch</a> extension is recommended.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to Properties" title="Direct link to Properties"></a></h3><table><thead><tr><th>Property</th><th>Description</th><th>Default</th></tr></thead><tbody><tr><td><code>type</code></td><td>Type of the aggregator. Must <code>fixedBucketsHistogram</code>.</td><td>No default, must be specified</td></tr><tr><td><code>name</code></td><td>Column name for the aggregator.</td><td>No default, must be specified</td></tr><tr><td><code>fieldName</code></td><td>Column name of the input to the aggregator.</td><td>No default, must be specified</td></tr><tr><td><code>lowerLimit</code></td><td>Lower limit of the histogram.</td><td>No default, must be specified</td></tr><tr><td><code>upperLimit</code></td><td>Upper limit of the histogram.</td><td>No default, must be specified</td></tr><tr><td><code>numBuckets</code></td><td>Number of buckets for the histogram. The range <!-- -->[lowerLimit, upperLimit]<!-- --> will be divided into <code>numBuckets</code> intervals of equal size.</td><td>10</td></tr><tr><td><code>outlierHandlingMode</code></td><td>Specifies how values outside of <!-- -->[lowerLimit, upperLimit]<!-- --> will be handled. Supported modes are &quot;ignore&quot;, &quot;overflow&quot;, and &quot;clip&quot;. See <a href="#outlier-handling-modes">outlier handling modes</a> for more details.</td><td>No default, must be specified</td></tr><tr><td><code>finalizeAsBase64Binary</code></td><td>If true, the finalized aggregator value will be a Base64-encoded byte array containing the <a href="#serialization-formats">serialized form</a> of the histogram. If false, the finalized aggregator value will be a JSON representation of the histogram.</td><td>false</td></tr></tbody></table><p>An example aggregator spec is shown below:</p><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;type&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;fixedBucketsHistogram&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;name&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;output_name&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;fieldName&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;metric_name&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;numBuckets&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;integer&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;lowerLimit&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;double&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;upperLimit&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;double&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;outlierHandlingMode&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;mode&gt;</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="outlier-handling-modes">Outlier handling modes<a href="#outlier-handling-modes" class="hash-link" aria-label="Direct link to Outlier handling modes" title="Direct link to Outlier handling modes"></a></h3><p>The outlier handling mode specifies what should be done with values outside of the histogram&#x27;s range. There are three supported modes:</p><ul><li><code>ignore</code>: Throw away outlier values.</li><li><code>overflow</code>: A count of outlier values will be tracked by the histogram, available in the <code>lowerOutlierCount</code> and <code>upperOutlierCount</code> fields.</li><li><code>clip</code>: Outlier values will be clipped to the <code>lowerLimit</code> or the <code>upperLimit</code> and included in the histogram.</li></ul><p>If you don&#x27;t care about outliers, <code>ignore</code> is the cheapest option performance-wise. There is currently no difference in storage size among the modes.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="output-fields">Output fields<a href="#output-fields" class="hash-link" aria-label="Direct link to Output fields" title="Direct link to Output fields"></a></h3><p>The histogram aggregator&#x27;s output object has the following fields:</p><ul><li><code>lowerLimit</code>: Lower limit of the histogram</li><li><code>upperLimit</code>: Upper limit of the histogram</li><li><code>numBuckets</code>: Number of histogram buckets</li><li><code>outlierHandlingMode</code>: Outlier handling mode</li><li><code>count</code>: Total number of values contained in the histogram, excluding outliers</li><li><code>lowerOutlierCount</code>: Count of outlier values below <code>lowerLimit</code>. Only used if the outlier mode is <code>overflow</code>.</li><li><code>upperOutlierCount</code>: Count of outlier values above <code>upperLimit</code>. Only used if the outlier mode is <code>overflow</code>.</li><li><code>missingValueCount</code>: Count of null values seen by the histogram.</li><li><code>max</code>: Max value seen by the histogram. This does not include outlier values.</li><li><code>min</code>: Min value seen by the histogram. This does not include outlier values.</li><li><code>histogram</code>: An array of longs with size <code>numBuckets</code>, containing the bucket counts</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="ingesting-existing-histograms">Ingesting existing histograms<a href="#ingesting-existing-histograms" class="hash-link" aria-label="Direct link to Ingesting existing histograms" title="Direct link to Ingesting existing histograms"></a></h3><p>It is also possible to ingest existing fixed buckets histograms. The input must be a Base64 string encoding a byte array that contains a serialized histogram object. Both &quot;full&quot; and &quot;sparse&quot; formats can be used. Please see <a href="#serialization-formats">Serialization formats</a> below for details.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="serialization-formats">Serialization formats<a href="#serialization-formats" class="hash-link" aria-label="Direct link to Serialization formats" title="Direct link to Serialization formats"></a></h3><h4 class="anchor anchorWithStickyNavbar_LWe7" id="full-serialization-format">Full serialization format<a href="#full-serialization-format" class="hash-link" aria-label="Direct link to Full serialization format" title="Direct link to Full serialization format"></a></h4><p>This format includes the full histogram bucket count array in the serialization format.</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token plain">byte: serialization version, must be 0x01</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">byte: encoding mode, 0x01 for full</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">double: lowerLimit</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">double: upperLimit</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">int: numBuckets</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">byte: outlier handling mode (0x00 for `ignore`, 0x01 for `overflow`, and 0x02 for `clip`)</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">long: count, total number of values contained in the histogram, excluding outliers</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">long: lowerOutlierCount</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">long: upperOutlierCount</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">long: missingValueCount</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">double: max</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">double: min</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">array of longs: bucket counts for the histogram</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="sparse-serialization-format">Sparse serialization format<a href="#sparse-serialization-format" class="hash-link" aria-label="Direct link to Sparse serialization format" title="Direct link to Sparse serialization format"></a></h4><p>This format represents the histogram bucket counts as (bucketNum, count) pairs. This serialization format is used when less than half of the histogram&#x27;s buckets have values.</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token plain">byte: serialization version, must be 0x01</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">byte: encoding mode, 0x02 for sparse</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">double: lowerLimit</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">double: upperLimit</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">int: numBuckets</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">byte: outlier handling mode (0x00 for `ignore`, 0x01 for `overflow`, and 0x02 for `clip`)</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">long: count, total number of values contained in the histogram, excluding outliers</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">long: lowerOutlierCount</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">long: upperOutlierCount</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">long: missingValueCount</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">double: max</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">double: min</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">int: number of following (bucketNum, count) pairs</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">sequence of (int, long) pairs:</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> int: bucket number</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> count: bucket count</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="combining-histograms-with-different-bucketing-schemes">Combining histograms with different bucketing schemes<a href="#combining-histograms-with-different-bucketing-schemes" class="hash-link" aria-label="Direct link to Combining histograms with different bucketing schemes" title="Direct link to Combining histograms with different bucketing schemes"></a></h3><p>It is possible to combine two histograms with different bucketing schemes (lowerLimit, upperLimit, numBuckets) together.</p><p>The bucketing scheme of the &quot;left hand&quot; histogram will be preserved (i.e., when running a query, the bucketing schemes specified in the query&#x27;s histogram aggregators will be preserved).</p><p>When merging, we assume that values are evenly distributed within the buckets of the &quot;right hand&quot; histogram.</p><p>When the right-hand histogram contains outliers (when using <code>overflow</code> mode), we assume that all of the outliers counted in the right-hand histogram will be outliers in the left-hand histogram as well.</p><p>For performance and accuracy reasons, we recommend avoiding aggregation of histograms with different bucketing schemes if possible.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="null-handling">Null handling<a href="#null-handling" class="hash-link" aria-label="Direct link to Null handling" title="Direct link to Null handling"></a></h3><p>If <code>druid.generic.useDefaultValueForNull</code> is false, null values will be tracked in the <code>missingValueCount</code> field of the histogram.</p><p>If <code>druid.generic.useDefaultValueForNull</code> is true, null values will be added to the histogram as the default 0.0 value.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="histogram-post-aggregators">Histogram post-aggregators<a href="#histogram-post-aggregators" class="hash-link" aria-label="Direct link to Histogram post-aggregators" title="Direct link to Histogram post-aggregators"></a></h2><p>Post-aggregators are used to transform opaque approximate histogram sketches
into bucketed histogram representations, as well as to compute various
distribution metrics such as quantiles, min, and max.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="equal-buckets-post-aggregator">Equal buckets post-aggregator<a href="#equal-buckets-post-aggregator" class="hash-link" aria-label="Direct link to Equal buckets post-aggregator" title="Direct link to Equal buckets post-aggregator"></a></h3><p>Computes a visual representation of the approximate histogram with a given number of equal-sized bins.
Bucket intervals are based on the range of the underlying data. This aggregator is not supported for the fixed buckets histogram.</p><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;type&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;equalBuckets&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;name&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;&lt;output_name&gt;&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;fieldName&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;&lt;aggregator_name&gt;&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;numBuckets&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;count&gt;</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="buckets-post-aggregator">Buckets post-aggregator<a href="#buckets-post-aggregator" class="hash-link" aria-label="Direct link to Buckets post-aggregator" title="Direct link to Buckets post-aggregator"></a></h3><p>Computes a visual representation given an initial breakpoint, offset, and a bucket size.</p><p>Bucket size determines the width of the binning interval.</p><p>Offset determines the value on which those interval bins align.</p><p>This aggregator is not supported for the fixed buckets histogram.</p><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;type&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;buckets&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;name&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;&lt;output_name&gt;&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;fieldName&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;&lt;aggregator_name&gt;&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;bucketSize&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;bucket_size&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;offset&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;offset&gt;</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="custom-buckets-post-aggregator">Custom buckets post-aggregator<a href="#custom-buckets-post-aggregator" class="hash-link" aria-label="Direct link to Custom buckets post-aggregator" title="Direct link to Custom buckets post-aggregator"></a></h3><p>Computes a visual representation of the approximate histogram with bins laid out according to the given breaks.</p><p>This aggregator is not supported for the fixed buckets histogram.</p><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> </span><span class="token property">&quot;type&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;customBuckets&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token property">&quot;name&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;output_name&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token property">&quot;fieldName&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;aggregator_name&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;breaks&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">[</span><span class="token plain"> &lt;value&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> &lt;value&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> ... </span><span class="token punctuation" style="color:rgb(199, 146, 234)">]</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="min-post-aggregator">min post-aggregator<a href="#min-post-aggregator" class="hash-link" aria-label="Direct link to min post-aggregator" title="Direct link to min post-aggregator"></a></h3><p>Returns the minimum value of the underlying approximate or fixed buckets histogram aggregator</p><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> </span><span class="token property">&quot;type&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;min&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token property">&quot;name&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;output_name&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token property">&quot;fieldName&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;aggregator_name&gt; </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="max-post-aggregator">max post-aggregator<a href="#max-post-aggregator" class="hash-link" aria-label="Direct link to max post-aggregator" title="Direct link to max post-aggregator"></a></h3><p>Returns the maximum value of the underlying approximate or fixed buckets histogram aggregator</p><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> </span><span class="token property">&quot;type&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;max&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token property">&quot;name&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;output_name&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token property">&quot;fieldName&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;aggregator_name&gt; </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="quantile-post-aggregator">quantile post-aggregator<a href="#quantile-post-aggregator" class="hash-link" aria-label="Direct link to quantile post-aggregator" title="Direct link to quantile post-aggregator"></a></h4><p>Computes a single quantile based on the underlying approximate or fixed buckets histogram aggregator</p><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> </span><span class="token property">&quot;type&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;quantile&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token property">&quot;name&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;output_name&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token property">&quot;fieldName&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;aggregator_name&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;probability&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;quantile&gt; </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="quantiles-post-aggregator">quantiles post-aggregator<a href="#quantiles-post-aggregator" class="hash-link" aria-label="Direct link to quantiles post-aggregator" title="Direct link to quantiles post-aggregator"></a></h4><p>Computes an array of quantiles based on the underlying approximate or fixed buckets histogram aggregator</p><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"> </span><span class="token property">&quot;type&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;quantiles&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token property">&quot;name&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;output_name&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token property">&quot;fieldName&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> &lt;aggregator_name&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"> </span><span class="token property">&quot;probabilities&quot;</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">[</span><span class="token plain"> &lt;quantile&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> &lt;quantile&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> ... </span><span class="token punctuation" style="color:rgb(199, 146, 234)">]</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#approximate-histogram-aggregator-deprecated" class="table-of-contents__link toc-highlight">Approximate Histogram aggregator (Deprecated)</a><ul><li><a href="#creating-approximate-histogram-sketches-at-ingestion-time" class="table-of-contents__link toc-highlight">Creating approximate histogram sketches at ingestion time</a></li></ul></li><li><a href="#fixed-buckets-histogram" class="table-of-contents__link toc-highlight">Fixed Buckets Histogram</a><ul><li><a href="#when-to-use" class="table-of-contents__link toc-highlight">When to use</a></li><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a></li><li><a href="#outlier-handling-modes" class="table-of-contents__link toc-highlight">Outlier handling modes</a></li><li><a href="#output-fields" class="table-of-contents__link toc-highlight">Output fields</a></li><li><a href="#ingesting-existing-histograms" class="table-of-contents__link toc-highlight">Ingesting existing histograms</a></li><li><a href="#serialization-formats" class="table-of-contents__link toc-highlight">Serialization formats</a></li><li><a href="#combining-histograms-with-different-bucketing-schemes" class="table-of-contents__link toc-highlight">Combining histograms with different bucketing schemes</a></li><li><a href="#null-handling" class="table-of-contents__link toc-highlight">Null handling</a></li></ul></li><li><a href="#histogram-post-aggregators" class="table-of-contents__link toc-highlight">Histogram post-aggregators</a><ul><li><a href="#equal-buckets-post-aggregator" class="table-of-contents__link toc-highlight">Equal buckets post-aggregator</a></li><li><a href="#buckets-post-aggregator" class="table-of-contents__link toc-highlight">Buckets post-aggregator</a></li><li><a href="#custom-buckets-post-aggregator" class="table-of-contents__link toc-highlight">Custom buckets post-aggregator</a></li><li><a href="#min-post-aggregator" class="table-of-contents__link toc-highlight">min post-aggregator</a></li><li><a href="#max-post-aggregator" class="table-of-contents__link toc-highlight">max post-aggregator</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="margin-bottom--sm"><img src="/img/favicon.png" class="themedImage_ToTc themedImage--light_HNdA footer__logo"><img src="/img/favicon.png" class="themedImage_ToTc themedImage--dark_i4oU footer__logo"></div><div class="footer__copyright">Copyright © 2023 Apache Software Foundation. Except where otherwise noted, licensed under CC BY-SA 4.0. Apache Druid, Druid, and the Druid logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries.</div></div></div></footer></div>
<script src="/assets/js/runtime~main.dc5f839a.js"></script>
<script src="/assets/js/main.a03dfc13.js"></script>
</body>
</html>