blob: be942a17789047d0f46ecc4b5b5743fcb697557a [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Apache Druid">
<meta name="keywords" content="druid,kafka,database,analytics,streaming,real-time,real time,apache,open source">
<meta name="author" content="Apache Software Foundation">
<title>Druid | TopN queries</title>
<link rel="alternate" type="application/atom+xml" href="/feed">
<link rel="shortcut icon" href="/img/favicon.png">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<link href='//fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700,300italic|Open+Sans:300italic,400italic,600italic,400,300,600,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/css/bootstrap-pure.css?v=1.1">
<link rel="stylesheet" href="/css/base.css?v=1.1">
<link rel="stylesheet" href="/css/header.css?v=1.1">
<link rel="stylesheet" href="/css/footer.css?v=1.1">
<link rel="stylesheet" href="/css/syntax.css?v=1.1">
<link rel="stylesheet" href="/css/docs.css?v=1.1">
<script>
(function() {
var cx = '000162378814775985090:molvbm0vggm';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
</head>
<body>
<!-- Start page_header include -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<div class="top-navigator">
<div class="container">
<div class="left-cont">
<a class="logo" href="/"><span class="druid-logo"></span></a>
</div>
<div class="right-cont">
<ul class="links">
<li class=""><a href="/technology">Technology</a></li>
<li class=""><a href="/use-cases">Use Cases</a></li>
<li class=""><a href="/druid-powered">Powered By</a></li>
<li class=""><a href="/docs/latest/design/">Docs</a></li>
<li class=""><a href="/community/">Community</a></li>
<li class="header-dropdown">
<a>Apache</a>
<div class="header-dropdown-menu">
<a href="https://www.apache.org/" target="_blank">Foundation</a>
<a href="https://www.apache.org/events/current-event" target="_blank">Events</a>
<a href="https://www.apache.org/licenses/" target="_blank">License</a>
<a href="https://www.apache.org/foundation/thanks.html" target="_blank">Thanks</a>
<a href="https://www.apache.org/security/" target="_blank">Security</a>
<a href="https://www.apache.org/foundation/sponsorship.html" target="_blank">Sponsorship</a>
</div>
</li>
<li class=" button-link"><a href="/downloads.html">Download</a></li>
</ul>
</div>
</div>
<div class="action-button menu-icon">
<span class="fa fa-bars"></span> MENU
</div>
<div class="action-button menu-icon-close">
<span class="fa fa-times"></span> MENU
</div>
</div>
<script type="text/javascript">
var $menu = $('.right-cont');
var $menuIcon = $('.menu-icon');
var $menuIconClose = $('.menu-icon-close');
function showMenu() {
$menu.fadeIn(100);
$menuIcon.fadeOut(100);
$menuIconClose.fadeIn(100);
}
$menuIcon.click(showMenu);
function hideMenu() {
$menu.fadeOut(100);
$menuIconClose.fadeOut(100);
$menuIcon.fadeIn(100);
}
$menuIconClose.click(hideMenu);
$(window).resize(function() {
if ($(window).width() >= 840) {
$menu.fadeIn(100);
$menuIcon.fadeOut(100);
$menuIconClose.fadeOut(100);
}
else {
$menu.fadeOut(100);
$menuIcon.fadeIn(100);
$menuIconClose.fadeOut(100);
}
});
</script>
<!-- Stop page_header include -->
<div class="container doc-container">
<p> Looking for the <a href="/docs/0.23.0/">latest stable documentation</a>?</p>
<div class="row">
<div class="col-md-9 doc-content">
<p>
<a class="btn btn-default btn-xs visible-xs-inline-block visible-sm-inline-block" href="#toc">Table of Contents</a>
</p>
<!--
~ 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.
-->
<h1 id="topn-queries">TopN queries</h1>
<p>TopN queries return a sorted set of results for the values in a given dimension according to some criteria. Conceptually, they can be thought of as an approximate <a href="../querying/groupbyquery.html">GroupByQuery</a> over a single dimension with an <a href="../querying/limitspec.html">Ordering</a> spec. TopNs are much faster and resource efficient than GroupBys for this use case. These types of queries take a topN query object and return an array of JSON objects where each object represents a value asked for by the topN query.</p>
<p>TopNs are approximate in that each node will rank their top K results and only return those top K results to the broker. K, by default in Druid, is <code>max(1000, threshold)</code>. In practice, this means that if you ask for the top 1000 items ordered, the correctness of the first ~900 items will be 100%, and the ordering of the results after that is not guaranteed. TopNs can be made more accurate by increasing the threshold.</p>
<p>A topN query object looks like:</p>
<div class="highlight"><pre><code class="language-json" data-lang="json"><span></span><span class="p">{</span>
<span class="nt">&quot;queryType&quot;</span><span class="p">:</span> <span class="s2">&quot;topN&quot;</span><span class="p">,</span>
<span class="nt">&quot;dataSource&quot;</span><span class="p">:</span> <span class="s2">&quot;sample_data&quot;</span><span class="p">,</span>
<span class="nt">&quot;dimension&quot;</span><span class="p">:</span> <span class="s2">&quot;sample_dim&quot;</span><span class="p">,</span>
<span class="nt">&quot;threshold&quot;</span><span class="p">:</span> <span class="mi">5</span><span class="p">,</span>
<span class="nt">&quot;metric&quot;</span><span class="p">:</span> <span class="s2">&quot;count&quot;</span><span class="p">,</span>
<span class="nt">&quot;granularity&quot;</span><span class="p">:</span> <span class="s2">&quot;all&quot;</span><span class="p">,</span>
<span class="nt">&quot;filter&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;and&quot;</span><span class="p">,</span>
<span class="nt">&quot;fields&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;selector&quot;</span><span class="p">,</span>
<span class="nt">&quot;dimension&quot;</span><span class="p">:</span> <span class="s2">&quot;dim1&quot;</span><span class="p">,</span>
<span class="nt">&quot;value&quot;</span><span class="p">:</span> <span class="s2">&quot;some_value&quot;</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;selector&quot;</span><span class="p">,</span>
<span class="nt">&quot;dimension&quot;</span><span class="p">:</span> <span class="s2">&quot;dim2&quot;</span><span class="p">,</span>
<span class="nt">&quot;value&quot;</span><span class="p">:</span> <span class="s2">&quot;some_other_val&quot;</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">},</span>
<span class="nt">&quot;aggregations&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;longSum&quot;</span><span class="p">,</span>
<span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;count&quot;</span><span class="p">,</span>
<span class="nt">&quot;fieldName&quot;</span><span class="p">:</span> <span class="s2">&quot;count&quot;</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;doubleSum&quot;</span><span class="p">,</span>
<span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;some_metric&quot;</span><span class="p">,</span>
<span class="nt">&quot;fieldName&quot;</span><span class="p">:</span> <span class="s2">&quot;some_metric&quot;</span>
<span class="p">}</span>
<span class="p">],</span>
<span class="nt">&quot;postAggregations&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;arithmetic&quot;</span><span class="p">,</span>
<span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;average&quot;</span><span class="p">,</span>
<span class="nt">&quot;fn&quot;</span><span class="p">:</span> <span class="s2">&quot;/&quot;</span><span class="p">,</span>
<span class="nt">&quot;fields&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;fieldAccess&quot;</span><span class="p">,</span>
<span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;some_metric&quot;</span><span class="p">,</span>
<span class="nt">&quot;fieldName&quot;</span><span class="p">:</span> <span class="s2">&quot;some_metric&quot;</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;fieldAccess&quot;</span><span class="p">,</span>
<span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;count&quot;</span><span class="p">,</span>
<span class="nt">&quot;fieldName&quot;</span><span class="p">:</span> <span class="s2">&quot;count&quot;</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">],</span>
<span class="nt">&quot;intervals&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="s2">&quot;2013-08-31T00:00:00.000/2013-09-03T00:00:00.000&quot;</span>
<span class="p">]</span>
<span class="p">}</span>
</code></pre></div>
<p>There are 11 parts to a topN query.</p>
<table><thead>
<tr>
<th>property</th>
<th>description</th>
<th>required?</th>
</tr>
</thead><tbody>
<tr>
<td>queryType</td>
<td>This String should always be &quot;topN&quot;; this is the first thing Druid looks at to figure out how to interpret the query</td>
<td>yes</td>
</tr>
<tr>
<td>dataSource</td>
<td>A String or Object defining the data source to query, very similar to a table in a relational database. See <a href="../querying/datasource.html">DataSource</a> for more information.</td>
<td>yes</td>
</tr>
<tr>
<td>intervals</td>
<td>A JSON Object representing ISO-8601 Intervals. This defines the time ranges to run the query over.</td>
<td>yes</td>
</tr>
<tr>
<td>granularity</td>
<td>Defines the granularity to bucket query results. See <a href="../querying/granularities.html">Granularities</a></td>
<td>yes</td>
</tr>
<tr>
<td>filter</td>
<td>See <a href="../querying/filters.html">Filters</a></td>
<td>no</td>
</tr>
<tr>
<td>aggregations</td>
<td>See <a href="../querying/aggregations.html">Aggregations</a></td>
<td>for numeric metricSpec, aggregations or postAggregations should be specified. Otherwise no.</td>
</tr>
<tr>
<td>postAggregations</td>
<td>See <a href="../querying/post-aggregations.html">Post Aggregations</a></td>
<td>for numeric metricSpec, aggregations or postAggregations should be specified. Otherwise no.</td>
</tr>
<tr>
<td>dimension</td>
<td>A String or JSON object defining the dimension that you want the top taken for. For more info, see <a href="../querying/dimensionspecs.html">DimensionSpecs</a></td>
<td>yes</td>
</tr>
<tr>
<td>threshold</td>
<td>An integer defining the N in the topN (i.e. how many results you want in the top list)</td>
<td>yes</td>
</tr>
<tr>
<td>metric</td>
<td>A String or JSON object specifying the metric to sort by for the top list. For more info, see <a href="../querying/topnmetricspec.html">TopNMetricSpec</a>.</td>
<td>yes</td>
</tr>
<tr>
<td>context</td>
<td>See <a href="../querying/query-context.html">Context</a></td>
<td>no</td>
</tr>
</tbody></table>
<p>Please note the context JSON object is also available for topN queries and should be used with the same caution as the timeseries case.
The format of the results would look like so:</p>
<div class="highlight"><pre><code class="language-json" data-lang="json"><span></span><span class="p">[</span>
<span class="p">{</span>
<span class="nt">&quot;timestamp&quot;</span><span class="p">:</span> <span class="s2">&quot;2013-08-31T00:00:00.000Z&quot;</span><span class="p">,</span>
<span class="nt">&quot;result&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="nt">&quot;dim1&quot;</span><span class="p">:</span> <span class="s2">&quot;dim1_val&quot;</span><span class="p">,</span>
<span class="nt">&quot;count&quot;</span><span class="p">:</span> <span class="mi">111</span><span class="p">,</span>
<span class="nt">&quot;some_metrics&quot;</span><span class="p">:</span> <span class="mi">10669</span><span class="p">,</span>
<span class="nt">&quot;average&quot;</span><span class="p">:</span> <span class="mf">96.11711711711712</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;dim1&quot;</span><span class="p">:</span> <span class="s2">&quot;another_dim1_val&quot;</span><span class="p">,</span>
<span class="nt">&quot;count&quot;</span><span class="p">:</span> <span class="mi">88</span><span class="p">,</span>
<span class="nt">&quot;some_metrics&quot;</span><span class="p">:</span> <span class="mi">28344</span><span class="p">,</span>
<span class="nt">&quot;average&quot;</span><span class="p">:</span> <span class="mf">322.09090909090907</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;dim1&quot;</span><span class="p">:</span> <span class="s2">&quot;dim1_val3&quot;</span><span class="p">,</span>
<span class="nt">&quot;count&quot;</span><span class="p">:</span> <span class="mi">70</span><span class="p">,</span>
<span class="nt">&quot;some_metrics&quot;</span><span class="p">:</span> <span class="mi">871</span><span class="p">,</span>
<span class="nt">&quot;average&quot;</span><span class="p">:</span> <span class="mf">12.442857142857143</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;dim1&quot;</span><span class="p">:</span> <span class="s2">&quot;dim1_val4&quot;</span><span class="p">,</span>
<span class="nt">&quot;count&quot;</span><span class="p">:</span> <span class="mi">62</span><span class="p">,</span>
<span class="nt">&quot;some_metrics&quot;</span><span class="p">:</span> <span class="mi">815</span><span class="p">,</span>
<span class="nt">&quot;average&quot;</span><span class="p">:</span> <span class="mf">13.14516129032258</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;dim1&quot;</span><span class="p">:</span> <span class="s2">&quot;dim1_val5&quot;</span><span class="p">,</span>
<span class="nt">&quot;count&quot;</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span>
<span class="nt">&quot;some_metrics&quot;</span><span class="p">:</span> <span class="mi">2787</span><span class="p">,</span>
<span class="nt">&quot;average&quot;</span><span class="p">:</span> <span class="mf">46.45</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">]</span>
</code></pre></div>
<h3 id="behavior-on-multi-value-dimensions">Behavior on multi-value dimensions</h3>
<p>topN queries can group on multi-value dimensions. When grouping on a multi-value dimension, <em>all</em> values
from matching rows will be used to generate one group per value. It&#39;s possible for a query to return more groups than
there are rows. For example, a topN on the dimension <code>tags</code> with filter <code>&quot;t1&quot; AND &quot;t3&quot;</code> would match only row1, and
generate a result with three groups: <code>t1</code>, <code>t2</code>, and <code>t3</code>. If you only need to include values that match
your filter, you can use a <a href="dimensionspecs.html#filtered-dimensionspecs">filtered dimensionSpec</a>. This can also
improve performance.</p>
<p>See <a href="multi-value-dimensions.html">Multi-value dimensions</a> for more details.</p>
<h3 id="aliasing">Aliasing</h3>
<p>The current TopN algorithm is an approximate algorithm. The top 1000 local results from each segment are returned for merging to determine the global topN. As such, the topN algorithm is approximate in both rank and results. Approximate results <em>ONLY APPLY WHEN THERE ARE MORE THAN 1000 DIM VALUES</em>. A topN over a dimension with fewer than 1000 unique dimension values can be considered accurate in rank and accurate in aggregates.</p>
<p>The threshold can be modified from it&#39;s default 1000 via the server parameter <code>druid.query.topN.minTopNThreshold</code> which need to restart servers to take effect or set <code>minTopNThreshold</code> in query context which take effect per query. </p>
<p>If you are wanting the top 100 of a high cardinality, uniformly distributed dimension ordered by some low-cardinality, uniformly distributed dimension, you are potentially going to get aggregates back that are missing data.</p>
<p>To put it another way, the best use cases for topN are when you can have confidence that the overall results are uniformly in the top. For example, if a particular site ID is in the top 10 for some metric for every hour of every day, then it will probably be accurate in the topN over multiple days. But if a site barely in the top 1000 for any given hour, but over the whole query granularity is in the top 500 (example: a site which gets highly uniform traffic co-mingling in the dataset with sites with highly periodic data), then a top500 query may not have that particular site a the exact rank, and may not be accurate for that particular site&#39;s aggregates.</p>
<p>Before continuing in this section, please consider if you really need exact results. Getting exact results is a very resource intensive process. For the vast majority of &quot;useful&quot; data results, an approximate topN algorithm supplies plenty of accuracy.</p>
<p>Users wishing to get an <em>exact rank and exact aggregates</em> topN over a dimension with greater than 1000 unique values should issue a groupBy query and sort the results themselves. This is very computationally expensive for high-cardinality dimensions.</p>
<p>Users who can tolerate <em>approximate rank</em> topN over a dimension with greater than 1000 unique values, but require <em>exact aggregates</em> can issue two queries. One to get the approximate topN dimension values, and another topN with dimension selection filters which only use the topN results of the first.</p>
<h4 id="example-first-query">Example First query:</h4>
<div class="highlight"><pre><code class="language-json" data-lang="json"><span></span><span class="p">{</span>
<span class="nt">&quot;aggregations&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="nt">&quot;fieldName&quot;</span><span class="p">:</span> <span class="s2">&quot;L_QUANTITY_longSum&quot;</span><span class="p">,</span>
<span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;L_QUANTITY_&quot;</span><span class="p">,</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;longSum&quot;</span>
<span class="p">}</span>
<span class="p">],</span>
<span class="nt">&quot;dataSource&quot;</span><span class="p">:</span> <span class="s2">&quot;tpch_year&quot;</span><span class="p">,</span>
<span class="nt">&quot;dimension&quot;</span><span class="p">:</span><span class="s2">&quot;l_orderkey&quot;</span><span class="p">,</span>
<span class="nt">&quot;granularity&quot;</span><span class="p">:</span> <span class="s2">&quot;all&quot;</span><span class="p">,</span>
<span class="nt">&quot;intervals&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="s2">&quot;1900-01-09T00:00:00.000Z/2992-01-10T00:00:00.000Z&quot;</span>
<span class="p">],</span>
<span class="nt">&quot;metric&quot;</span><span class="p">:</span> <span class="s2">&quot;L_QUANTITY_&quot;</span><span class="p">,</span>
<span class="nt">&quot;queryType&quot;</span><span class="p">:</span> <span class="s2">&quot;topN&quot;</span><span class="p">,</span>
<span class="nt">&quot;threshold&quot;</span><span class="p">:</span> <span class="mi">2</span>
<span class="p">}</span>
</code></pre></div>
<h4 id="example-second-query">Example second query:</h4>
<div class="highlight"><pre><code class="language-json" data-lang="json"><span></span><span class="p">{</span>
<span class="nt">&quot;aggregations&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="nt">&quot;fieldName&quot;</span><span class="p">:</span> <span class="s2">&quot;L_TAX_doubleSum&quot;</span><span class="p">,</span>
<span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;L_TAX_&quot;</span><span class="p">,</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;doubleSum&quot;</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;fieldName&quot;</span><span class="p">:</span> <span class="s2">&quot;L_DISCOUNT_doubleSum&quot;</span><span class="p">,</span>
<span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;L_DISCOUNT_&quot;</span><span class="p">,</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;doubleSum&quot;</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;fieldName&quot;</span><span class="p">:</span> <span class="s2">&quot;L_EXTENDEDPRICE_doubleSum&quot;</span><span class="p">,</span>
<span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;L_EXTENDEDPRICE_&quot;</span><span class="p">,</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;doubleSum&quot;</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;fieldName&quot;</span><span class="p">:</span> <span class="s2">&quot;L_QUANTITY_longSum&quot;</span><span class="p">,</span>
<span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;L_QUANTITY_&quot;</span><span class="p">,</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;longSum&quot;</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;count&quot;</span><span class="p">,</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;count&quot;</span>
<span class="p">}</span>
<span class="p">],</span>
<span class="nt">&quot;dataSource&quot;</span><span class="p">:</span> <span class="s2">&quot;tpch_year&quot;</span><span class="p">,</span>
<span class="nt">&quot;dimension&quot;</span><span class="p">:</span><span class="s2">&quot;l_orderkey&quot;</span><span class="p">,</span>
<span class="nt">&quot;filter&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;fields&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="nt">&quot;dimension&quot;</span><span class="p">:</span> <span class="s2">&quot;l_orderkey&quot;</span><span class="p">,</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;selector&quot;</span><span class="p">,</span>
<span class="nt">&quot;value&quot;</span><span class="p">:</span> <span class="s2">&quot;103136&quot;</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;dimension&quot;</span><span class="p">:</span> <span class="s2">&quot;l_orderkey&quot;</span><span class="p">,</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;selector&quot;</span><span class="p">,</span>
<span class="nt">&quot;value&quot;</span><span class="p">:</span> <span class="s2">&quot;1648672&quot;</span>
<span class="p">}</span>
<span class="p">],</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;or&quot;</span>
<span class="p">},</span>
<span class="nt">&quot;granularity&quot;</span><span class="p">:</span> <span class="s2">&quot;all&quot;</span><span class="p">,</span>
<span class="nt">&quot;intervals&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="s2">&quot;1900-01-09T00:00:00.000Z/2992-01-10T00:00:00.000Z&quot;</span>
<span class="p">],</span>
<span class="nt">&quot;metric&quot;</span><span class="p">:</span> <span class="s2">&quot;L_QUANTITY_&quot;</span><span class="p">,</span>
<span class="nt">&quot;queryType&quot;</span><span class="p">:</span> <span class="s2">&quot;topN&quot;</span><span class="p">,</span>
<span class="nt">&quot;threshold&quot;</span><span class="p">:</span> <span class="mi">2</span>
<span class="p">}</span>
</code></pre></div>
</div>
<div class="col-md-3">
<div class="searchbox">
<gcse:searchbox-only></gcse:searchbox-only>
</div>
<div id="toc" class="nav toc hidden-print">
</div>
</div>
</div>
</div>
<!-- Start page_footer include -->
<footer class="druid-footer">
<div class="container">
<div class="text-center">
<p>
<a href="/technology">Technology</a>&ensp;·&ensp;
<a href="/use-cases">Use Cases</a>&ensp;·&ensp;
<a href="/druid-powered">Powered by Druid</a>&ensp;·&ensp;
<a href="/docs/latest/">Docs</a>&ensp;·&ensp;
<a href="/community/">Community</a>&ensp;·&ensp;
<a href="/downloads.html">Download</a>&ensp;·&ensp;
<a href="/faq">FAQ</a>
</p>
</div>
<div class="text-center">
<a title="Join the user group" href="https://groups.google.com/forum/#!forum/druid-user" target="_blank"><span class="fa fa-comments"></span></a>&ensp;·&ensp;
<a title="Follow Druid" href="https://twitter.com/druidio" target="_blank"><span class="fab fa-twitter"></span></a>&ensp;·&ensp;
<a title="GitHub" href="https://github.com/apache/druid" target="_blank"><span class="fab fa-github"></span></a>
</div>
<div class="text-center license">
Copyright © 2020 <a href="https://www.apache.org/" target="_blank">Apache Software Foundation</a>.<br>
Except where otherwise noted, licensed under <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a>.<br>
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>
</footer>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-131010415-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-131010415-1');
</script>
<script>
function trackDownload(type, url) {
ga('send', 'event', 'download', type, url);
}
</script>
<script src="//code.jquery.com/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="/assets/js/druid.js"></script>
<!-- stop page_footer include -->
<script>
$(function() {
$(".toc").load("/docs/0.13.0-incubating/toc.html");
// There is no way to tell when .gsc-input will be async loaded into the page so just try to set a placeholder until it works
var tries = 0;
var timer = setInterval(function() {
tries++;
if (tries > 300) clearInterval(timer);
var searchInput = $('input.gsc-input');
if (searchInput.length) {
searchInput.attr('placeholder', 'Search');
clearInterval(timer);
}
}, 100);
});
</script>
</body>
</html>