This is an automated email from the ASF dual-hosted git repository.

jark pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit ca85cabcbcd3223f69ac99686c54c8c24da4c8b9
Author: luoyuxia <[email protected]>
AuthorDate: Mon Aug 29 15:04:49 2022 +0800

    [FLINK-29025][docs] add sort/cluster/distribute by page for Hive dialect
---
 .../Queries/sort-cluster-distribute-by.md          | 94 ++++++++++++++++++++++
 .../Queries/sort-cluster-distribute-by.md          | 94 ++++++++++++++++++++++
 2 files changed, 188 insertions(+)

diff --git 
a/docs/content.zh/docs/dev/table/hiveCompatibility/hiveDialect/Queries/sort-cluster-distribute-by.md
 
b/docs/content.zh/docs/dev/table/hiveCompatibility/hiveDialect/Queries/sort-cluster-distribute-by.md
new file mode 100644
index 00000000000..5f6954bb880
--- /dev/null
+++ 
b/docs/content.zh/docs/dev/table/hiveCompatibility/hiveDialect/Queries/sort-cluster-distribute-by.md
@@ -0,0 +1,94 @@
+---
+title: "Sort/Cluster/Distributed By"
+weight: 2
+type: docs
+---
+<!--
+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.
+-->
+
+# Sort/Cluster/Distributed by Clause
+
+## Sort By
+
+### Description
+
+Unlike [ORDER BY]({{< ref 
"docs/dev/table/hiveCompatibility/hiveDialect/Queries/overview" 
>}}#order-by-clause) which guarantees a total order of output,
+`SORT BY` only guarantees the result rows with each partition is in the user 
specified order.
+So when there's more than one partition, `SORT BY` may return result that's 
partially ordered.
+
+### Syntax
+
+```sql
+colOrder: ( ASC | DESC )
+sortBy: SORT BY BY expression [ , ... ]
+query: SELECT expression [ , ... ] FROM src sortBy
+```
+
+### Parameters
+- colOrder
+
+  it's used specified the order of returned rows. The default order is `ASC`.
+
+### Examples
+
+```sql
+SELECT x, y FROM t SORT BY x;
+SELECT x, y FROM t SORT BY abs(y) DESC;
+```
+
+## Distribute By
+
+### Description
+
+The `DISTRIBUTE BY` clause is used to repartition the data.
+The data with same value evaluated by the specified expression will be in same 
partition.
+
+### Syntax
+
+```sql
+distributeBy: DISTRIBUTE BY expression [ , ... ]
+query: SELECT expression [ , ... ] FROM src distributeBy
+```
+
+### Examples
+
+```sql
+SELECT x, y FROM t DISTRIBUTE BY x;
+SELECT x, y FROM t DISTRIBUTE BY abs(y);
+```
+
+## Cluster By
+
+### Description
+
+`CLUSTER BY` is a short-cut for both `DISTRIBUTE BY` and `SORT BY`.
+The `CLUSTER BY` is used to first repartition the data based on the input 
expressions and sort the data with each partition.
+Also, this clause only guarantees the data is sorted within each partition.
+
+### Syntax
+
+```sql
+clusterBy: CLUSTER BY expression [ , ... ]
+query: SELECT expression [ , ... ] FROM src clusterBy
+```
+
+### Examples
+
+```sql
+SELECT x, y FROM t CLUSTER BY x;
+SELECT x, y FROM t CLUSTER BY abs(y);
+```
diff --git 
a/docs/content/docs/dev/table/hiveCompatibility/hiveDialect/Queries/sort-cluster-distribute-by.md
 
b/docs/content/docs/dev/table/hiveCompatibility/hiveDialect/Queries/sort-cluster-distribute-by.md
new file mode 100644
index 00000000000..5f6954bb880
--- /dev/null
+++ 
b/docs/content/docs/dev/table/hiveCompatibility/hiveDialect/Queries/sort-cluster-distribute-by.md
@@ -0,0 +1,94 @@
+---
+title: "Sort/Cluster/Distributed By"
+weight: 2
+type: docs
+---
+<!--
+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.
+-->
+
+# Sort/Cluster/Distributed by Clause
+
+## Sort By
+
+### Description
+
+Unlike [ORDER BY]({{< ref 
"docs/dev/table/hiveCompatibility/hiveDialect/Queries/overview" 
>}}#order-by-clause) which guarantees a total order of output,
+`SORT BY` only guarantees the result rows with each partition is in the user 
specified order.
+So when there's more than one partition, `SORT BY` may return result that's 
partially ordered.
+
+### Syntax
+
+```sql
+colOrder: ( ASC | DESC )
+sortBy: SORT BY BY expression [ , ... ]
+query: SELECT expression [ , ... ] FROM src sortBy
+```
+
+### Parameters
+- colOrder
+
+  it's used specified the order of returned rows. The default order is `ASC`.
+
+### Examples
+
+```sql
+SELECT x, y FROM t SORT BY x;
+SELECT x, y FROM t SORT BY abs(y) DESC;
+```
+
+## Distribute By
+
+### Description
+
+The `DISTRIBUTE BY` clause is used to repartition the data.
+The data with same value evaluated by the specified expression will be in same 
partition.
+
+### Syntax
+
+```sql
+distributeBy: DISTRIBUTE BY expression [ , ... ]
+query: SELECT expression [ , ... ] FROM src distributeBy
+```
+
+### Examples
+
+```sql
+SELECT x, y FROM t DISTRIBUTE BY x;
+SELECT x, y FROM t DISTRIBUTE BY abs(y);
+```
+
+## Cluster By
+
+### Description
+
+`CLUSTER BY` is a short-cut for both `DISTRIBUTE BY` and `SORT BY`.
+The `CLUSTER BY` is used to first repartition the data based on the input 
expressions and sort the data with each partition.
+Also, this clause only guarantees the data is sorted within each partition.
+
+### Syntax
+
+```sql
+clusterBy: CLUSTER BY expression [ , ... ]
+query: SELECT expression [ , ... ] FROM src clusterBy
+```
+
+### Examples
+
+```sql
+SELECT x, y FROM t CLUSTER BY x;
+SELECT x, y FROM t CLUSTER BY abs(y);
+```

Reply via email to