You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by hu...@apache.org on 2022/03/02 19:58:34 UTC
[spark] branch master updated: [MINOR][SQL][DOCS] Add more examples to sql-ref-syntax-ddl-create-table-datasource
This is an automated email from the ASF dual-hosted git repository.
huaxingao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 829d7fb [MINOR][SQL][DOCS] Add more examples to sql-ref-syntax-ddl-create-table-datasource
829d7fb is described below
commit 829d7fb045e47f1ddd43f2645949ea8257ca330d
Author: Yuming Wang <yu...@ebay.com>
AuthorDate: Wed Mar 2 11:57:38 2022 -0800
[MINOR][SQL][DOCS] Add more examples to sql-ref-syntax-ddl-create-table-datasource
### What changes were proposed in this pull request?
Add more examples to sql-ref-syntax-ddl-create-table-datasource:
1. Create partitioned and bucketed table through CTAS.
2. Create bucketed table through CTAS and CTE
### Why are the changes needed?
Improve doc.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Manual test.
Closes #35712 from wangyum/sql-ref-syntax-ddl-create-table-datasource.
Authored-by: Yuming Wang <yu...@ebay.com>
Signed-off-by: huaxingao <hu...@apple.com>
---
docs/sql-ref-syntax-ddl-create-table-datasource.md | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/docs/sql-ref-syntax-ddl-create-table-datasource.md b/docs/sql-ref-syntax-ddl-create-table-datasource.md
index ba0516a..9fa5dcb 100644
--- a/docs/sql-ref-syntax-ddl-create-table-datasource.md
+++ b/docs/sql-ref-syntax-ddl-create-table-datasource.md
@@ -132,6 +132,23 @@ CREATE TABLE student (id INT, name STRING, age INT)
USING CSV
PARTITIONED BY (age)
CLUSTERED BY (Id) INTO 4 buckets;
+
+--Create partitioned and bucketed table through CTAS
+CREATE TABLE student_partition_bucket
+ USING parquet
+ PARTITIONED BY (age)
+ CLUSTERED BY (id) INTO 4 buckets
+ AS SELECT * FROM student;
+
+--Create bucketed table through CTAS and CTE
+CREATE TABLE student_bucket
+ USING parquet
+ CLUSTERED BY (id) INTO 4 buckets (
+ WITH tmpTable AS (
+ SELECT * FROM student WHERE id > 100
+ )
+ SELECT * FROM tmpTable
+);
```
### Related Statements
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org