maropu commented on a change in pull request #30888:
URL: https://github.com/apache/spark/pull/30888#discussion_r547246688
##########
File path: docs/sql-ref-syntax-dml-insert-into.md
##########
@@ -45,6 +45,13 @@ INSERT INTO [ TABLE ] table_identifier [ partition_spec ]
**Syntax:** `PARTITION ( partition_col_name = partition_col_val [ , ... ]
)`
+* **column_list**
+
+ An optional parameter that specifies a comma separated list of columns
belong to the `table_identifier`.
Review comment:
nit:
- `comma separated` -> `comma-separated`
- `belong` -> `belonging`
- `the table_identifier` -> `the table_identifier table`
##########
File path: docs/sql-ref-syntax-dml-insert-into.md
##########
@@ -26,7 +26,7 @@ The `INSERT INTO` statement inserts new rows into a table.
The inserted rows can
### Syntax
```sql
-INSERT INTO [ TABLE ] table_identifier [ partition_spec ]
+INSERT INTO [ TABLE ] table_identifier [ partition_spec ] [ column_list ]
Review comment:
`[ column_list ]` -> `[ ( column_list ) ]`
##########
File path: docs/sql-ref-syntax-dml-insert-into.md
##########
@@ -198,6 +205,36 @@ SELECT * FROM students;
+-------------+--------------------------+----------+
```
+#### Insert with a column list
+
+```sql
+INSERT INTO students (address, name, student_id) VALUES
+ ('Hangzhou, China', 'Kent Yao', 11215016);
+
+SELECT * FROM students WHERE name = 'Kent Yao';
++---------+----------------------+----------+
+| name| address|student_id|
++---------+----------------------+----------+
+|Kent Yao |Hangzhou, China | 11215016|
++---------+----------------------+----------+
+
+```
+
+#### Insert with both a partition spec and a column list
+
+```sql
+INSERT INTO students PARTITION (student_id = 11215017) (address, name) VALUES
+ ('Hangzhou, China', 'Kent Yao Jr.');
+
+SELECT * FROM students WHERE student_id = '11215017';
++------------+----------------------+----------+
+| name| address|student_id|
++------------+----------------------+----------+
+|Kent Yao Jr.|Hangzhou, China | 11215017|
++------------+----------------------+----------+
+
Review comment:
nit: remove this blank.
##########
File path: docs/sql-ref-syntax-dml-insert-into.md
##########
@@ -45,6 +45,13 @@ INSERT INTO [ TABLE ] table_identifier [ partition_spec ]
**Syntax:** `PARTITION ( partition_col_name = partition_col_val [ , ... ]
)`
+* **column_list**
+
+ An optional parameter that specifies a comma separated list of columns
belong to the `table_identifier`.
+ All specified columns should exist in the `table_identifier` and not be
duplicated from each other. It includes all columns except the static partition
columns.
+ The size of the column list should be exactly the size of the data from
`VALUES` clause or query.
+ The order of the column list is alterable and determines how the data from
`VALUES` clause or query to be inserted by position.
Review comment:
How about organizing it like this (it seems some statements above
describe the current limitations):
```
* **colunn_list**
<param description>
**Note**
The current behaviour has some limitations:
1. The column list should contain all the column names in the
`table_identifier` table.
2. ...
```
(ref:
https://github.com/apache/spark/blame/master/docs/sql-ref-syntax-qry-select-having.md#L43-L48)
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]