Repository: drill-site
Updated Branches:
  refs/heads/asf-site b373927d2 -> 02bdbdac0


updates for DRILL-3652 and DRILL-3904


Project: http://git-wip-us.apache.org/repos/asf/drill-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill-site/commit/02bdbdac
Tree: http://git-wip-us.apache.org/repos/asf/drill-site/tree/02bdbdac
Diff: http://git-wip-us.apache.org/repos/asf/drill-site/diff/02bdbdac

Branch: refs/heads/asf-site
Commit: 02bdbdac037ac4fcf2f210013b59e6007138681d
Parents: b373927
Author: Bridget Bevens <[email protected]>
Authored: Wed Oct 7 16:01:19 2015 -0700
Committer: Bridget Bevens <[email protected]>
Committed: Wed Oct 7 16:01:19 2015 -0700

----------------------------------------------------------------------
 .../index.html                                  | 27 ++++++++++++++++----
 feed.xml                                        |  4 +--
 2 files changed, 24 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill-site/blob/02bdbdac/docs/sql-window-functions-introduction/index.html
----------------------------------------------------------------------
diff --git a/docs/sql-window-functions-introduction/index.html 
b/docs/sql-window-functions-introduction/index.html
index a764f39..5c04943 100644
--- a/docs/sql-window-functions-introduction/index.html
+++ b/docs/sql-window-functions-introduction/index.html
@@ -1034,9 +1034,7 @@ To compare, you can run a query using the AVG() function 
as a standard set funct
 </code></pre></div>
 <p>The query returns one row with the average of all the values in the 
specified column instead of returning values for each row.  </p>
 
-<p>You can also include the optional PARTITION BY and ORDER BY clauses in a 
query. The PARTITION BY clause subdivides the window into partitions. The ORDER 
BY clause defines the logical order of the rows within each partition of the 
result set.  </p>
-
-<p>Window functions are applied to the rows within each partition and sorted 
according to the order specification.  </p>
+<p>You can also include the optional PARTITION BY and ORDER BY clauses in a 
query. The PARTITION BY clause subdivides the window into partitions. The ORDER 
BY clause defines the logical order of the rows within each partition of the 
result set. Window functions are applied to the rows within each partition and 
sorted according to the order specification.  </p>
 
 <p>The following query uses the AVG() window function with the PARTITION BY 
clause to determine the average car sales for each dealer in Q1:  </p>
 <div class="highlight"><pre><code class="language-text" data-lang="text">   
select emp_name, dealer_id, sales, avg(sales) over (partition by dealer_id) as 
avgsales from q1_sales;
@@ -1054,7 +1052,25 @@ To compare, you can run a query using the AVG() function 
as a standard set funct
    | Abel Kim        | 3          | 12369  | 12368     |
    | May Stout       | 3          | 9308   | 12368     |
    +-----------------+------------+--------+-----------+
-   10 rows selected (0.215 seconds)
+   10 rows selected (0.215 seconds)  
+</code></pre></div>
+<p>The following query uses the AVG() and ROW_NUM() window functions to 
determine the average car sales for each dealer in Q1 and assign a row number 
to each row in a partition:  </p>
+<div class="highlight"><pre><code class="language-text" data-lang="text">   
select dealer_id, sales, emp_name,row_number() over (partition by dealer_id 
order by sales) as `row`,avg(sales) over (partition by dealer_id) as avgsales 
from q1_sales;
+   +------------+--------+-----------------+------+---------------+
+   | dealer_id  | sales  |    emp_name     | row  |      avgsales |
+   +------------+--------+-----------------+------+---------------+
+   | 1          | 8227   | Raphael Hull    | 1    | 14356         |
+   | 1          | 9710   | Jack Salazar    | 2    | 14356         |
+   | 1          | 19745  | Ferris Brown    | 3    | 14356         |
+   | 1          | 19745  | Noel Meyer      | 4    | 14356         |
+   | 2          | 9308   | Haviva Montoya  | 1    | 13924         |
+   | 2          | 16233  | Beverly Lang    | 2    | 13924         |
+   | 2          | 16233  | Kameko French   | 3    | 13924         |
+   | 3          | 9308   | May Stout       | 1    | 12368         |
+   | 3          | 12369  | Abel Kim        | 2    | 12368         |
+   | 3          | 15427  | Ursa George     | 3    | 12368         |
+   +------------+--------+-----------------+------+---------------+
+   10 rows selected (0.37 seconds)  
 </code></pre></div>
 <h2 id="types-of-window-functions">Types of Window Functions</h2>
 
@@ -1179,7 +1195,8 @@ The frame_clause specifies the group of rows that create 
the window frame. Curre
 <li>Window functions precede ORDER BY.<br></li>
 <li>Drill processes window functions after the WHERE, GROUP BY, and HAVING 
clauses.<br></li>
 <li>Including the OVER() clause after an aggregate set function turns the 
function into an aggregate window function. </li>
-<li>You can use window functions to aggregate over any number of rows in the 
window frame. </li>
+<li>You can use window functions to aggregate over any number of rows in the 
window frame.</li>
+<li>If you want to run a window function on the result set returned by the 
FLATTEN clause, use FLATTEN in a subquery. For example: <code>select x, y, a, 
sum(x) over() from  ( select x , y, flatten(z) as a from 
`complex.json`);</code></li>
 </ul>
 
     

http://git-wip-us.apache.org/repos/asf/drill-site/blob/02bdbdac/feed.xml
----------------------------------------------------------------------
diff --git a/feed.xml b/feed.xml
index 8d01455..605484d 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>Tue, 06 Oct 2015 16:47:12 -0700</pubDate>
-    <lastBuildDate>Tue, 06 Oct 2015 16:47:12 -0700</lastBuildDate>
+    <pubDate>Wed, 07 Oct 2015 15:54:20 -0700</pubDate>
+    <lastBuildDate>Wed, 07 Oct 2015 15:54:20 -0700</lastBuildDate>
     <generator>Jekyll v2.5.2</generator>
     
       <item>

Reply via email to