techdocsmith commented on code in PR #15902:
URL: https://github.com/apache/druid/pull/15902#discussion_r1496729713


##########
docs/querying/sql-window-functions.md:
##########
@@ -88,40 +88,171 @@ You can use the OVER clause to treat other Druid 
aggregation functions as window
 
 Window functions support aliasing.
 
-## Define a window with the OVER clause
+## Window function syntax
+
+In general, Druid Window functions use the following syntax:
+
+```sql
+SELECT
+    dimensions,
+    aggregation function(s)
+    window_function()
+      OVER ( PARTITION BY partitioning expression
+             ORDER BY order expression
+             frame clause
+            )
+    FROM table
+    GROUP BY dimensions
+```
 
 The OVER clause defines the query windows for window functions as follows:
 - PARTITION BY indicates the dimension that defines the rows within the window
 - ORDER BY specifies the order of the rows within the windows.
 
+for example, the following OVER clause example sets the window dimension to 
`channel` and orders the results by the absolute value of `delta` ascending:
+
+```sql
+...
+RANK() OVER (PARTITION BY channel ORDER BY ABS(delta) ASC)
+...
+```
+
+Druid applies the GROUP BY dimensions first before calculating all non-window 
aggregation functions. Then it applies the window function over the aggregate 
results.

Review Comment:
   @soumyava, @kgyrtkirk what does an empty `OVER()` indicate? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to