srowen commented on a change in pull request #27289: [SPARK-30581][DOC] 
Document SORT BY Clause of SELECT statement in SQLReference.
URL: https://github.com/apache/spark/pull/27289#discussion_r368607842
 
 

 ##########
 File path: docs/sql-ref-syntax-qry-select-sortby.md
 ##########
 @@ -0,0 +1,172 @@
+---
+layout: global
+title: SORT BY Clause
+displayTitle: SORT BY Clause
+license: |
+  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.
+---
+The <code>SORT BY</code> clause is used to return the result rows sorted
+within each partition in the user specified order. When there are more than 
one partition
+<code>SORT BY</code> may return results that is partially ordered. This is 
different
+than <code>ORDER BY</code> clause which guarantees total ordering of the 
output.
+
+### Syntax
+{% highlight sql %}
+SORT BY { expression [ sort_direction | nulls_sort_oder ] [ , ...] }
+{% endhighlight %}
+
+### Parameters
+<dl>
+  <dt><code><em>SORT BY</em></code></dt>
+  <dd>
+    Specifies a comma separated list of expression along with optional 
parameters sort_direction 
+    and nulls_sort_order which are used to sort the rows within each partition.
+  </dd>
+  <dt><code><em>sort_direction</em></code></dt>
+  <dd>
+    Optionally specifies whether to sort the rows in ascending (lowest to 
highest) or descending
+    (highest to lowest) order. The valid values for sort direction are 
<code>ASC</code> for ascending
+    and <code>DESC</code> for descending. If sort direction is not explicitly 
specified then by default
+    rows are sorted in ascending manner. <br><br>
+    <b>Syntax:</b>
+    <code>
+       [ ASC | DESC ]
+    </code>
+  </dd>
+  <dt><code><em>nulls_sort_order</em></code></dt>
+  <dd>
+    Optionally specifies whether NULL values are returned before/after 
non-NULL values, based on the 
+    sort direction. In spark, NULL values are considered to be lower than any 
non-NULL values. Therefore
 
 Review comment:
   spark -> Spark. Are you describing a default here? make it explicit if so. 
Because this option lets you control that behavior, right?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to