This is an automated email from the ASF dual-hosted git repository.
huaxingao pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.2 by this push:
new c0e4e73 [MINOR][SQL][DOCS] Add more examples to
sql-ref-syntax-ddl-create-table-datasource
c0e4e73 is described below
commit c0e4e73c38cc7dfa1f06ea5ae59b1ce9fcab14ad
Author: Yuming Wang <[email protected]>
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 <[email protected]>
Signed-off-by: huaxingao <[email protected]>
(cherry picked from commit 829d7fb045e47f1ddd43f2645949ea8257ca330d)
Signed-off-by: huaxingao <[email protected]>
---
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: [email protected]
For additional commands, e-mail: [email protected]