You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by br...@apache.org on 2019/04/10 01:59:48 UTC
[drill-site] branch asf-site updated: add nearestdate function to
docs
This is an automated email from the ASF dual-hosted git repository.
bridgetb pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/drill-site.git
The following commit(s) were added to refs/heads/asf-site by this push:
new cf1f8b1 add nearestdate function to docs
cf1f8b1 is described below
commit cf1f8b10e645ad139a333c823284efc025be2636
Author: Bridget Bevens <bb...@maprtech.com>
AuthorDate: Tue Apr 9 18:59:33 2019 -0700
add nearestdate function to docs
---
docs/date-time-functions-and-arithmetic/index.html | 66 +++++++++++++++++++++-
docs/plugin-configuration-basics/index.html | 4 +-
feed.xml | 4 +-
3 files changed, 68 insertions(+), 6 deletions(-)
diff --git a/docs/date-time-functions-and-arithmetic/index.html b/docs/date-time-functions-and-arithmetic/index.html
index 90c523d..87b28d2 100644
--- a/docs/date-time-functions-and-arithmetic/index.html
+++ b/docs/date-time-functions-and-arithmetic/index.html
@@ -1304,7 +1304,7 @@
</div>
- Jan 15, 2019
+ Apr 10, 2019
<link href="/css/docpage.css" rel="stylesheet" type="text/css">
@@ -1377,6 +1377,10 @@
<td>BIGINT</td>
</tr>
<tr>
+<td><a href="/docs/date-time-functions-and-arithmetic/#nearestdate">NEARESTDATE</a>**</td>
+<td>TIMESTAMP</td>
+</tr>
+<tr>
<td><a href="/docs/date-time-functions-and-arithmetic/#timestampadd">TIMESTAMPADD</a>*</td>
<td>Inferred based on unit of time</td>
</tr>
@@ -1390,7 +1394,8 @@
</tr>
</tbody></table>
-<p>*Supported in Drill 1.15 and later.</p>
+<p>*Supported in Drill 1.15 and later.
+**Supported in Drill 1.16 and later.</p>
<h2 id="age">AGE</h2>
@@ -2017,6 +2022,63 @@ SELECT UNIX_TIMESTAMP('2015-05-29 08:18:53.0', 'yyyy-MM-dd HH:mm:ss.
+-------------+
1 row selected (0.171 seconds)
</code></pre></div>
+<h2 id="nearestdate">NEARESTDATE</h2>
+
+<p>Quickly and easily aggregates timestamp data by various units of time. </p>
+
+<p><strong>Note:</strong> Drill 1.16 and later supports the NEARESTDATE function.</p>
+
+<h3 id="nearestdate-syntax">NEARESTDATE Syntax</h3>
+
+<p>NEARESTDATE(<em>column</em>, '<em>interval</em>' ) </p>
+
+<h3 id="nearestdate-usage-notes">NEARESTDATE Usage Notes</h3>
+
+<ul>
+<li>Use with COUNT and GROUP BY to aggregate timestamp data. </li>
+<li><em>column</em> is a data source column with timestamp values.<br></li>
+<li><em>interval</em> is any of the following units of time:
+
+<ul>
+<li>YEAR</li>
+<li>QUARTER</li>
+<li>MONTH</li>
+<li>WEEK_SUNDAY</li>
+<li>WEEK_MONDAY</li>
+<li>DAY</li>
+<li>HOUR</li>
+<li>HALF_HOUR</li>
+<li>QUARTER_HOUR</li>
+<li>MINUTE</li>
+<li>30SECOND</li>
+<li>15SECOND</li>
+<li>SECOND<br></li>
+</ul></li>
+</ul>
+
+<h3 id="nearestdate-examples">NEARESTDATE Examples</h3>
+
+<p>The following example uses the NEARESTDATE function to aggregate hire dates by year:</p>
+<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT NEARESTDATE(hire_date, 'YEAR' ) AS hireDate, COUNT(*) AS `count` FROM cp.`employee.json` GROUP BY NEARESTDATE(hire_date, 'YEAR');
++-----------------------+-------+
+| hireDate | count |
++-----------------------+-------+
+| 1994-01-01 00:00:00.0 | 23 |
+| 1998-01-01 00:00:00.0 | 539 |
+| 1996-01-01 00:00:00.0 | 503 |
+| 1995-01-01 00:00:00.0 | 12 |
+| 1997-01-01 00:00:00.0 | 74 |
+| 1993-01-01 00:00:00.0 | 4 |
++-----------------------+-------+
+</code></pre></div>
+<p>The following example applies the NEARESTDATE function to a timestamp value (2019-02-01 07:22:00) and returns the timestamp value for each time unit indicated: </p>
+<div class="highlight"><pre><code class="language-text" data-lang="text">SELECT nearestDate( TO_TIMESTAMP('2019-02-01 07:22:00', 'yyyy-MM-dd HH:mm:ss'), 'YEAR') AS nearest_year, nearestDate( TO_TIMESTAMP('2019-02-01 07:22:00', 'yyyy-MM-dd HH:mm:ss'), 'QUARTER') AS nearest_quarter, nearestDate( TO_TIMESTAMP('2019-02-15 07:22:00', 'yyyy-MM-dd HH:mm:ss'), 'MONTH') AS nearest_month, nearestDate( TO_TIMESTAMP('2019-02 [...]
++-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
+| nearest_year | nearest_quarter | nearest_month | nearest_day | nearest_week_sunday | nearest_week_monday | nearest_hour | nearest_half_hour | nearest_quarter_hour | nearest_minute | nearest_30second | nearest_15second | nearest_second |
++-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
+| 2019-01-01 00:00:00.0 | 2019-01-01 00:00:00.0 | 2019-02-01 00:00:00.0 | 2019-02-15 00:00:00.0 | 2019-02-10 00:00:00.0 | 2019-02-11 00:00:00.0 | 2019-02-15 07:00:00.0 | 2019-02-15 07:30:00.0 | 2019-02-15 07:45:00.0 | 2019-02-15 07:22:00.0 | 2019-02-15 07:22:00.0 | 2019-02-15 07:22:15.0 | 2019-02-15 07:22:31.0 |
++-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
+</code></pre></div>
<h2 id="timestampadd">TIMESTAMPADD</h2>
<p>Adds an interval of time, in the given time units, to a datetime expression. </p>
diff --git a/docs/plugin-configuration-basics/index.html b/docs/plugin-configuration-basics/index.html
index 1f11a56..0dfb527 100644
--- a/docs/plugin-configuration-basics/index.html
+++ b/docs/plugin-configuration-basics/index.html
@@ -1304,7 +1304,7 @@
</div>
- Apr 9, 2019
+ Apr 10, 2019
<link href="/css/docpage.css" rel="stylesheet" type="text/css">
@@ -1387,7 +1387,7 @@
</tr>
<tr>
<td>"formats" . . . "type"</td>
- <td>"pcap"<br>"pcapng"<br>"text"<br>"parquet"<br>"json"<br>"maprdb"<br>"avro"<br>"image"<br>"sequencefile"<br>"httpd"<br>"<a href="/docs/sys-log-format-plugin/">syslog</a>"</td>
+ <td>"pcap"<br>"pcapng"<br>"text"<br>"parquet"<br>"json"<br>"maprdb"<br>"avro"<br>"image"<br>"sequencefile"<br>"httpd"<br>"<a href="/docs/syslog-format-plugin/">syslog</a>"</td>
<td>yes</td>
<td>Format type. You can define two formats, csv and psv, as type "Text", but having different delimiters. </td>
</tr>
diff --git a/feed.xml b/feed.xml
index 4774c5b..52ff532 100644
--- a/feed.xml
+++ b/feed.xml
@@ -6,8 +6,8 @@
</description>
<link>/</link>
<atom:link href="/feed.xml" rel="self" type="application/rss+xml"/>
- <pubDate>Mon, 08 Apr 2019 18:34:08 -0700</pubDate>
- <lastBuildDate>Mon, 08 Apr 2019 18:34:08 -0700</lastBuildDate>
+ <pubDate>Tue, 09 Apr 2019 18:57:00 -0700</pubDate>
+ <lastBuildDate>Tue, 09 Apr 2019 18:57:00 -0700</lastBuildDate>
<generator>Jekyll v2.5.2</generator>
<item>