blob: 2c3f18bf4c58d0b5df5c2391acfab6ea75150f65 [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 | Scan query</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.20.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="scan-query">Scan query</h1>
<p>The Scan query returns raw Apache Druid (incubating) rows in streaming mode. The biggest difference between the Select query and the Scan
query is that the Scan query does not retain all the returned rows in memory before they are returned to the client.<br>
The Select query <em>will</em> retain the rows in memory, causing memory pressure if too many rows are returned.<br>
The Scan query can return all the rows without issuing another pagination query.</p>
<p>In addition to straightforward usage where a Scan query is issued to the Broker, the Scan query can also be issued
directly to Historical processes or streaming ingestion tasks. This can be useful if you want to retrieve large
amounts of data in parallel.</p>
<p>An example Scan query object is shown below:</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;scan&quot;</span><span class="p">,</span>
<span class="nt">&quot;dataSource&quot;</span><span class="p">:</span> <span class="s2">&quot;wikipedia&quot;</span><span class="p">,</span>
<span class="nt">&quot;resultFormat&quot;</span><span class="p">:</span> <span class="s2">&quot;list&quot;</span><span class="p">,</span>
<span class="nt">&quot;columns&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;2013-01-01/2013-01-02&quot;</span>
<span class="p">],</span>
<span class="nt">&quot;batchSize&quot;</span><span class="p">:</span><span class="mi">20480</span><span class="p">,</span>
<span class="nt">&quot;limit&quot;</span><span class="p">:</span><span class="mi">3</span>
<span class="p">}</span>
</code></pre></div>
<p>The following are the main parameters for Scan queries:</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;scan&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>resultFormat</td>
<td>How the results are represented: list, compactedList or valueVector. Currently only <code>list</code> and <code>compactedList</code> are supported. Default is <code>list</code></td>
<td>no</td>
</tr>
<tr>
<td>filter</td>
<td>See <a href="../querying/filters.html">Filters</a></td>
<td>no</td>
</tr>
<tr>
<td>columns</td>
<td>A String array of dimensions and metrics to scan. If left empty, all dimensions and metrics are returned.</td>
<td>no</td>
</tr>
<tr>
<td>batchSize</td>
<td>How many rows buffered before return to client. Default is <code>20480</code></td>
<td>no</td>
</tr>
<tr>
<td>limit</td>
<td>How many rows to return. If not specified, all rows will be returned.</td>
<td>no</td>
</tr>
<tr>
<td>order</td>
<td>The ordering of returned rows based on timestamp. &quot;ascending&quot;, &quot;descending&quot;, and &quot;none&quot; (default) are supported. Currently, &quot;ascending&quot; and &quot;descending&quot; are only supported for queries where the <code>__time</code> column is included in the <code>columns</code> field and the requirements outlined in the <a href="#time-ordering">time ordering</a> section are met.</td>
<td>none</td>
</tr>
<tr>
<td>legacy</td>
<td>Return results consistent with the legacy &quot;scan-query&quot; contrib extension. Defaults to the value set by <code>druid.query.scan.legacy</code>, which in turn defaults to false. See <a href="#legacy-mode">Legacy mode</a> for details.</td>
<td>no</td>
</tr>
<tr>
<td>context</td>
<td>An additional JSON Object which can be used to specify certain flags (see the Query Context Properties section below).</td>
<td>no</td>
</tr>
</tbody></table>
<h2 id="example-results">Example results</h2>
<p>The format of the result when resultFormat equals <code>list</code>:</p>
<div class="highlight"><pre><code class="language-json" data-lang="json"><span></span> <span class="p">[{</span>
<span class="nt">&quot;segmentId&quot;</span> <span class="p">:</span> <span class="s2">&quot;wikipedia_editstream_2012-12-29T00:00:00.000Z_2013-01-10T08:00:00.000Z_2013-01-10T08:13:47.830Z_v9&quot;</span><span class="p">,</span>
<span class="nt">&quot;columns&quot;</span> <span class="p">:</span> <span class="p">[</span>
<span class="s2">&quot;timestamp&quot;</span><span class="p">,</span>
<span class="s2">&quot;robot&quot;</span><span class="p">,</span>
<span class="s2">&quot;namespace&quot;</span><span class="p">,</span>
<span class="s2">&quot;anonymous&quot;</span><span class="p">,</span>
<span class="s2">&quot;unpatrolled&quot;</span><span class="p">,</span>
<span class="s2">&quot;page&quot;</span><span class="p">,</span>
<span class="s2">&quot;language&quot;</span><span class="p">,</span>
<span class="s2">&quot;newpage&quot;</span><span class="p">,</span>
<span class="s2">&quot;user&quot;</span><span class="p">,</span>
<span class="s2">&quot;count&quot;</span><span class="p">,</span>
<span class="s2">&quot;added&quot;</span><span class="p">,</span>
<span class="s2">&quot;delta&quot;</span><span class="p">,</span>
<span class="s2">&quot;variation&quot;</span><span class="p">,</span>
<span class="s2">&quot;deleted&quot;</span>
<span class="p">],</span>
<span class="nt">&quot;events&quot;</span> <span class="p">:</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-01-01T00:00:00.000Z&quot;</span><span class="p">,</span>
<span class="nt">&quot;robot&quot;</span> <span class="p">:</span> <span class="s2">&quot;1&quot;</span><span class="p">,</span>
<span class="nt">&quot;namespace&quot;</span> <span class="p">:</span> <span class="s2">&quot;article&quot;</span><span class="p">,</span>
<span class="nt">&quot;anonymous&quot;</span> <span class="p">:</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span>
<span class="nt">&quot;unpatrolled&quot;</span> <span class="p">:</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span>
<span class="nt">&quot;page&quot;</span> <span class="p">:</span> <span class="s2">&quot;11._korpus_(NOVJ)&quot;</span><span class="p">,</span>
<span class="nt">&quot;language&quot;</span> <span class="p">:</span> <span class="s2">&quot;sl&quot;</span><span class="p">,</span>
<span class="nt">&quot;newpage&quot;</span> <span class="p">:</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span>
<span class="nt">&quot;user&quot;</span> <span class="p">:</span> <span class="s2">&quot;EmausBot&quot;</span><span class="p">,</span>
<span class="nt">&quot;count&quot;</span> <span class="p">:</span> <span class="mf">1.0</span><span class="p">,</span>
<span class="nt">&quot;added&quot;</span> <span class="p">:</span> <span class="mf">39.0</span><span class="p">,</span>
<span class="nt">&quot;delta&quot;</span> <span class="p">:</span> <span class="mf">39.0</span><span class="p">,</span>
<span class="nt">&quot;variation&quot;</span> <span class="p">:</span> <span class="mf">39.0</span><span class="p">,</span>
<span class="nt">&quot;deleted&quot;</span> <span class="p">:</span> <span class="mf">0.0</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-01-01T00:00:00.000Z&quot;</span><span class="p">,</span>
<span class="nt">&quot;robot&quot;</span> <span class="p">:</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span>
<span class="nt">&quot;namespace&quot;</span> <span class="p">:</span> <span class="s2">&quot;article&quot;</span><span class="p">,</span>
<span class="nt">&quot;anonymous&quot;</span> <span class="p">:</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span>
<span class="nt">&quot;unpatrolled&quot;</span> <span class="p">:</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span>
<span class="nt">&quot;page&quot;</span> <span class="p">:</span> <span class="s2">&quot;112_U.S._580&quot;</span><span class="p">,</span>
<span class="nt">&quot;language&quot;</span> <span class="p">:</span> <span class="s2">&quot;en&quot;</span><span class="p">,</span>
<span class="nt">&quot;newpage&quot;</span> <span class="p">:</span> <span class="s2">&quot;1&quot;</span><span class="p">,</span>
<span class="nt">&quot;user&quot;</span> <span class="p">:</span> <span class="s2">&quot;MZMcBride&quot;</span><span class="p">,</span>
<span class="nt">&quot;count&quot;</span> <span class="p">:</span> <span class="mf">1.0</span><span class="p">,</span>
<span class="nt">&quot;added&quot;</span> <span class="p">:</span> <span class="mf">70.0</span><span class="p">,</span>
<span class="nt">&quot;delta&quot;</span> <span class="p">:</span> <span class="mf">70.0</span><span class="p">,</span>
<span class="nt">&quot;variation&quot;</span> <span class="p">:</span> <span class="mf">70.0</span><span class="p">,</span>
<span class="nt">&quot;deleted&quot;</span> <span class="p">:</span> <span class="mf">0.0</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-01-01T00:00:00.000Z&quot;</span><span class="p">,</span>
<span class="nt">&quot;robot&quot;</span> <span class="p">:</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span>
<span class="nt">&quot;namespace&quot;</span> <span class="p">:</span> <span class="s2">&quot;article&quot;</span><span class="p">,</span>
<span class="nt">&quot;anonymous&quot;</span> <span class="p">:</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span>
<span class="nt">&quot;unpatrolled&quot;</span> <span class="p">:</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span>
<span class="nt">&quot;page&quot;</span> <span class="p">:</span> <span class="s2">&quot;113_U.S._243&quot;</span><span class="p">,</span>
<span class="nt">&quot;language&quot;</span> <span class="p">:</span> <span class="s2">&quot;en&quot;</span><span class="p">,</span>
<span class="nt">&quot;newpage&quot;</span> <span class="p">:</span> <span class="s2">&quot;1&quot;</span><span class="p">,</span>
<span class="nt">&quot;user&quot;</span> <span class="p">:</span> <span class="s2">&quot;MZMcBride&quot;</span><span class="p">,</span>
<span class="nt">&quot;count&quot;</span> <span class="p">:</span> <span class="mf">1.0</span><span class="p">,</span>
<span class="nt">&quot;added&quot;</span> <span class="p">:</span> <span class="mf">77.0</span><span class="p">,</span>
<span class="nt">&quot;delta&quot;</span> <span class="p">:</span> <span class="mf">77.0</span><span class="p">,</span>
<span class="nt">&quot;variation&quot;</span> <span class="p">:</span> <span class="mf">77.0</span><span class="p">,</span>
<span class="nt">&quot;deleted&quot;</span> <span class="p">:</span> <span class="mf">0.0</span>
<span class="p">}</span> <span class="p">]</span>
<span class="p">}</span> <span class="p">]</span>
</code></pre></div>
<p>The format of the result when resultFormat equals <code>compactedList</code>:</p>
<div class="highlight"><pre><code class="language-json" data-lang="json"><span></span> <span class="p">[{</span>
<span class="nt">&quot;segmentId&quot;</span> <span class="p">:</span> <span class="s2">&quot;wikipedia_editstream_2012-12-29T00:00:00.000Z_2013-01-10T08:00:00.000Z_2013-01-10T08:13:47.830Z_v9&quot;</span><span class="p">,</span>
<span class="nt">&quot;columns&quot;</span> <span class="p">:</span> <span class="p">[</span>
<span class="s2">&quot;timestamp&quot;</span><span class="p">,</span> <span class="s2">&quot;robot&quot;</span><span class="p">,</span> <span class="s2">&quot;namespace&quot;</span><span class="p">,</span> <span class="s2">&quot;anonymous&quot;</span><span class="p">,</span> <span class="s2">&quot;unpatrolled&quot;</span><span class="p">,</span> <span class="s2">&quot;page&quot;</span><span class="p">,</span> <span class="s2">&quot;language&quot;</span><span class="p">,</span> <span class="s2">&quot;newpage&quot;</span><span class="p">,</span> <span class="s2">&quot;user&quot;</span><span class="p">,</span> <span class="s2">&quot;count&quot;</span><span class="p">,</span> <span class="s2">&quot;added&quot;</span><span class="p">,</span> <span class="s2">&quot;delta&quot;</span><span class="p">,</span> <span class="s2">&quot;variation&quot;</span><span class="p">,</span> <span class="s2">&quot;deleted&quot;</span>
<span class="p">],</span>
<span class="nt">&quot;events&quot;</span> <span class="p">:</span> <span class="p">[</span>
<span class="p">[</span><span class="s2">&quot;2013-01-01T00:00:00.000Z&quot;</span><span class="p">,</span> <span class="s2">&quot;1&quot;</span><span class="p">,</span> <span class="s2">&quot;article&quot;</span><span class="p">,</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span> <span class="s2">&quot;11._korpus_(NOVJ)&quot;</span><span class="p">,</span> <span class="s2">&quot;sl&quot;</span><span class="p">,</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span> <span class="s2">&quot;EmausBot&quot;</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">,</span> <span class="mf">39.0</span><span class="p">,</span> <span class="mf">39.0</span><span class="p">,</span> <span class="mf">39.0</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">],</span>
<span class="p">[</span><span class="s2">&quot;2013-01-01T00:00:00.000Z&quot;</span><span class="p">,</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span> <span class="s2">&quot;article&quot;</span><span class="p">,</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span> <span class="s2">&quot;112_U.S._580&quot;</span><span class="p">,</span> <span class="s2">&quot;en&quot;</span><span class="p">,</span> <span class="s2">&quot;1&quot;</span><span class="p">,</span> <span class="s2">&quot;MZMcBride&quot;</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">,</span> <span class="mf">70.0</span><span class="p">,</span> <span class="mf">70.0</span><span class="p">,</span> <span class="mf">70.0</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">],</span>
<span class="p">[</span><span class="s2">&quot;2013-01-01T00:00:00.000Z&quot;</span><span class="p">,</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span> <span class="s2">&quot;article&quot;</span><span class="p">,</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span> <span class="s2">&quot;113_U.S._243&quot;</span><span class="p">,</span> <span class="s2">&quot;en&quot;</span><span class="p">,</span> <span class="s2">&quot;1&quot;</span><span class="p">,</span> <span class="s2">&quot;MZMcBride&quot;</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">,</span> <span class="mf">77.0</span><span class="p">,</span> <span class="mf">77.0</span><span class="p">,</span> <span class="mf">77.0</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">]</span>
<span class="p">]</span>
<span class="p">}</span> <span class="p">]</span>
</code></pre></div>
<h2 id="time-ordering">Time Ordering</h2>
<p>The Scan query currently supports ordering based on timestamp for non-legacy queries. Note that using time ordering
will yield results that do not indicate which segment rows are from (<code>segmentId</code> will show up as <code>null</code>). Furthermore,
time ordering is only supported where the result set limit is less than <code>druid.query.scan.maxRowsQueuedForOrdering</code>
rows <strong>or</strong> all segments scanned have fewer than <code>druid.query.scan.maxSegmentPartitionsOrderedInMemory</code> partitions. Also,
time ordering is not supported for queries issued directly to historicals unless a list of segments is specified. The
reasoning behind these limitations is that the implementation of time ordering uses two strategies that can consume too
much heap memory if left unbounded. These strategies (listed below) are chosen on a per-Historical basis depending on
query result set limit and the number of segments being scanned.</p>
<ol>
<li><p>Priority Queue: Each segment on a Historical is opened sequentially. Every row is added to a bounded priority
queue which is ordered by timestamp. For every row above the result set limit, the row with the earliest (if descending)
or latest (if ascending) timestamp will be dequeued. After every row has been processed, the sorted contents of the
priority queue are streamed back to the Broker(s) in batches. Attempting to load too many rows into memory runs the
risk of Historical nodes running out of memory. The <code>druid.query.scan.maxRowsQueuedForOrdering</code> property protects
from this by limiting the number of rows in the query result set when time ordering is used.</p></li>
<li><p>N-Way Merge: For each segment, each partition is opened in parallel. Since each partition&#39;s rows are already
time-ordered, an n-way merge can be performed on the results from each partition. This approach doesn&#39;t persist the entire
result set in memory (like the Priority Queue) as it streams back batches as they are returned from the merge function.
However, attempting to query too many partition could also result in high memory usage due to the need to open
decompression and decoding buffers for each. The <code>druid.query.scan.maxSegmentPartitionsOrderedInMemory</code> limit protects
from this by capping the number of partitions opened at any times when time ordering is used.</p></li>
</ol>
<p>Both <code>druid.query.scan.maxRowsQueuedForOrdering</code> and <code>druid.query.scan.maxSegmentPartitionsOrderedInMemory</code> are
configurable and can be tuned based on hardware specs and number of dimensions being queried. These config properties
can also be overridden using the <code>maxRowsQueuedForOrdering</code> and <code>maxSegmentPartitionsOrderedInMemory</code> properties in
the query context (see the Query Context Properties section).</p>
<h2 id="legacy-mode">Legacy mode</h2>
<p>The Scan query supports a legacy mode designed for protocol compatibility with the former scan-query contrib extension.
In legacy mode you can expect the following behavior changes:</p>
<ul>
<li>The <strong>time column is returned as &quot;timestamp&quot; rather than &quot;</strong>time&quot;. This will take precedence over any other column
you may have that is named &quot;timestamp&quot;.</li>
<li>The __time column is included in the list of columns even if you do not specifically ask for it.</li>
<li>Timestamps are returned as ISO8601 time strings rather than integers (milliseconds since 1970-01-01 00:00:00 UTC).</li>
</ul>
<p>Legacy mode can be triggered either by passing <code>&quot;legacy&quot; : true</code> in your query JSON, or by setting
<code>druid.query.scan.legacy = true</code> on your Druid processes. If you were previously using the scan-query contrib extension,
the best way to migrate is to activate legacy mode during a rolling upgrade, then switch it off after the upgrade
is complete.</p>
<h2 id="configuration-properties">Configuration Properties</h2>
<p>Configuration properties:</p>
<table><thead>
<tr>
<th>property</th>
<th>description</th>
<th>values</th>
<th>default</th>
</tr>
</thead><tbody>
<tr>
<td>druid.query.scan.maxRowsQueuedForOrdering</td>
<td>The maximum number of rows returned when time ordering is used</td>
<td>An integer in [1, 2147483647]</td>
<td>100000</td>
</tr>
<tr>
<td>druid.query.scan.maxSegmentPartitionsOrderedInMemory</td>
<td>The maximum number of segments scanned per historical when time ordering is used</td>
<td>An integer in [1, 2147483647]</td>
<td>50</td>
</tr>
<tr>
<td>druid.query.scan.legacy</td>
<td>Whether legacy mode should be turned on for Scan queries</td>
<td>true or false</td>
<td>false</td>
</tr>
</tbody></table>
<h2 id="query-context-properties">Query Context Properties</h2>
<table><thead>
<tr>
<th>property</th>
<th>description</th>
<th>values</th>
<th>default</th>
</tr>
</thead><tbody>
<tr>
<td>maxRowsQueuedForOrdering</td>
<td>The maximum number of rows returned when time ordering is used. Overrides the identically named config.</td>
<td>An integer in [1, 2147483647]</td>
<td><code>druid.query.scan.maxRowsQueuedForOrdering</code></td>
</tr>
<tr>
<td>maxSegmentPartitionsOrderedInMemory</td>
<td>The maximum number of segments scanned per historical when time ordering is used. Overrides the identically named config.</td>
<td>An integer in [1, 2147483647]</td>
<td><code>druid.query.scan.maxSegmentPartitionsOrderedInMemory</code></td>
</tr>
</tbody></table>
<p>Sample query context JSON object:</p>
<div class="highlight"><pre><code class="language-json" data-lang="json"><span></span><span class="p">{</span>
<span class="nt">&quot;maxRowsQueuedForOrdering&quot;</span><span class="p">:</span> <span class="mi">100001</span><span class="p">,</span>
<span class="nt">&quot;maxSegmentPartitionsOrderedInMemory&quot;</span><span class="p">:</span> <span class="mi">100</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.15.1-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>