You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/01/18 08:51:13 UTC
[GitHub] [spark] yutoacts opened a new pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
yutoacts opened a new pull request #35239:
URL: https://github.com/apache/spark/pull/35239
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a faster review.
7. If you want to add a new configuration, please read the guideline first for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
8. If you want to add or modify an error type or message, please read the guideline first in
'core/src/main/resources/error/README.md'.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
Add some missing statements to the ALTER TABLE document (which are mainly supported with v2 table).
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
To let users know those statements and how to use them.
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
Yes, docs changed.
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
-->
`SKIP_API=1 bundle exec jekyll build`
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yutoacts commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
yutoacts commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r791538241
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -309,6 +397,116 @@ DESC StudentInfo;
| age| int| NULL|
+-----------------------+---------+-------+
+-- Drop columns of a table
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| name| string| NULL|
+| rollno| int| NULL|
+| LastName| string| NULL|
+| DOB|timestamp| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+ALTER TABLE StudentInfo DROP columns (LastName, DOB);
Review comment:
@cloud-fan Thanks for the review. right, those statements I added except `RECOVER PARTITIONS` are not supported by builtin sources but users can technically use them by their custom file sources so I think they should be documented. I mentioned in a doc that they are only supported with v2 tables. Do you think they should not be in example?
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -309,6 +397,116 @@ DESC StudentInfo;
| age| int| NULL|
+-----------------------+---------+-------+
+-- Drop columns of a table
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| name| string| NULL|
+| rollno| int| NULL|
+| LastName| string| NULL|
+| DOB|timestamp| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+ALTER TABLE StudentInfo DROP columns (LastName, DOB);
Review comment:
@cloud-fan Thanks for the review. right, those statements I added except `RECOVER PARTITIONS` are not supported by builtin sources but users can technically use them with their custom file sources so I think they should be documented. I mentioned in a doc that they are only supported with v2 tables. Do you think they should not be in example?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r793249421
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -75,6 +75,50 @@ ALTER TABLE table_identifier ADD COLUMNS ( col_spec [ , ... ] )
Specifies the columns to be added.
+### DROP COLUMNS
+
+`ALTER TABLE DROP COLUMNS` statement drops mentioned columns from an existing table.
+Note that this statement is only supported with v2 tables.
+
+
Review comment:
nit: I think one blank line. There are a couple of more places that you have an extra blank line.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan closed pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #35239:
URL: https://github.com/apache/spark/pull/35239
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yutoacts commented on pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
yutoacts commented on pull request #35239:
URL: https://github.com/apache/spark/pull/35239#issuecomment-1017181212
Also moved `ALTER OR CHANGE COLUMNS` example a bit above to match the order of the documentation.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r793255420
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -101,6 +145,27 @@ ALTER TABLE table_identifier { ALTER | CHANGE } [ COLUMN ] col_spec alterColumnA
Change column's definition.
+### REPLACE COLUMNS
+
+`ALTER TABLE REPLACE COLUMNS` statement removes all existing columns and adds the new set of columns.
+Note that this statement is only supported with v2 tables.
+
+
+#### Syntax
+
+```sql
+ALTER TABLE table_identifier REPLACE COLUMNS
+ [ ( col_name1 col_type1 [ COMMENT col_comment1 ], ... ) ]
+```
Review comment:
This one is a little complicated. Here is the syntax:
```
| ALTER TABLE table=multipartIdentifier partitionSpec?
REPLACE COLUMNS
'(' columns=qualifiedColTypeWithPositionList ')'
qualifiedColTypeWithPositionList
: qualifiedColTypeWithPosition (',' qualifiedColTypeWithPosition)*
;
qualifiedColTypeWithPosition
: name=multipartIdentifier dataType (NOT NULL)? commentSpec? colPosition?
;
```
Could you please make the syntax more accurate?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r791573775
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -75,6 +75,54 @@ ALTER TABLE table_identifier ADD COLUMNS ( col_spec [ , ... ] )
Specifies the columns to be added.
+### DROP COLUMNS
+
+`ALTER TABLE DROP COLUMNS` statement drops mentioned columns of an existing table.
+Note that this statement is only supported with v2 tables.
+
+
+#### Syntax
+
+```sql
+ALTER TABLE table_identifier DROP COLUMNS ( col_spec [ , ... ] )
Review comment:
shouldn't DROP COLUMN only take column names?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #35239:
URL: https://github.com/apache/spark/pull/35239#issuecomment-1021041302
@huaxingao can you review this first?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r791564965
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -75,6 +75,54 @@ ALTER TABLE table_identifier ADD COLUMNS ( col_spec [ , ... ] )
Specifies the columns to be added.
+### DROP COLUMNS
+
+`ALTER TABLE DROP COLUMNS` statement drops mentioned columns of an existing table.
Review comment:
```suggestion
`ALTER TABLE DROP COLUMNS` statement drops mentioned columns from an existing table.
```
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r793256119
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -309,6 +393,116 @@ DESC StudentInfo;
| age| int| NULL|
+-----------------------+---------+-------+
+-- Drop columns of a table
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| name| string| NULL|
+| rollno| int| NULL|
+| LastName| string| NULL|
+| DOB|timestamp| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+ALTER TABLE StudentInfo DROP columns (LastName, DOB);
+
+-- After dropping columns of the table
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| name| string| NULL|
+| rollno| int| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+-- Rename a column of a table
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| name| string| NULL|
+| rollno| int| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+ALTER TABLE StudentInfo RENAME COLUMN name TO FirstName;
+
+-- After renaming a column of the table
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| FirstName| string| NULL|
+| rollno| int| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+-- ALTER OR CHANGE COLUMNS
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| FirstName| string| NULL|
+| rollno| int| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+ALTER TABLE StudentInfo ALTER COLUMN FirstName COMMENT "new comment";
+
+--After ALTER or CHANGE COLUMNS
+DESC StudentInfo;
++-----------------------+---------+-----------+
+| col_name|data_type| comment|
++-----------------------+---------+-----------+
+| FirstName| string|new comment|
+| rollno| int| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type| comment|
+| age| int| NULL|
++-----------------------+---------+-----------+
+
+-- REPLACE COLUMNS
+DESC StudentInfo;
++-----------------------+---------+-----------+
+| col_name|data_type| comment|
++-----------------------+---------+-----------+
+| FirstName| string|new comment|
+| rollno| int| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type| comment|
+| age| int| NULL|
++-----------------------+---------+-----------+
+
+ALTER TABLE StudentInfo REPLACE COLUMNS (name string, ID int COMMENT 'new comment');
+
+--After replacing COLUMNS
Review comment:
nit: space after `-`
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -435,6 +597,9 @@ ALTER TABLE dbx.tab1 SET TBLPROPERTIES ('comment' = 'This is a new comment.');
-- DROP TABLE PROPERTIES
ALTER TABLE dbx.tab1 UNSET TBLPROPERTIES ('winner');
+
+-- RECOVER PARTITIONS
+ALTER TABLE dbx.tab1 RECOVER PARTITIONS
Review comment:
nit: `;` in the end
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r794251533
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -166,6 +167,18 @@ ALTER TABLE table_identifier REPLACE COLUMNS
**Syntax:** `[ database_name. ] table_name`
+* **partition_spec**
+
+ Partition to be replaced. Note that one can use a typed literal (e.g., date'2019-01-02') in the partition spec.
+
+ **Syntax:** `PARTITION ( partition_col_name = partition_col_val [ , ... ] )`
+
+* **qualified_col_type_with_position_list**
+
+ The list of the column(s) to be added
+
+ **Syntax:** `( col_name col_type [ col_comment ] [ col_position ] [ , ... ] )`
Review comment:
nit: I think we don't need the `(` `)`. It is already specified in L159.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yutoacts commented on pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
yutoacts commented on pull request #35239:
URL: https://github.com/apache/spark/pull/35239#issuecomment-1021882929
@cloud-fan thanks, fixed them.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r793253463
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -75,6 +75,50 @@ ALTER TABLE table_identifier ADD COLUMNS ( col_spec [ , ... ] )
Specifies the columns to be added.
+### DROP COLUMNS
+
+`ALTER TABLE DROP COLUMNS` statement drops mentioned columns from an existing table.
+Note that this statement is only supported with v2 tables.
+
+
+#### Syntax
+
+```sql
+ALTER TABLE table_identifier DROP COLUMNS ( col_name1, ... )
+```
+
+#### Parameters
+
+* **table_identifier**
+
+ Specifies a table name, which may be optionally qualified with a database name.
+
+ **Syntax:** `[ database_name. ] table_name`
+
+### RENAME COLUMN
+
+`ALTER TABLE RENAME COLUMN` statement changes the column name of an existing table.
+Note that this statement is only supported with v2 tables.
+
+
+#### Syntax
+
+```sql
+ALTER TABLE table_identifier RENAME COLUMN col_spec to col_spec
Review comment:
nit: capitalize `to`
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yutoacts commented on pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
yutoacts commented on pull request #35239:
URL: https://github.com/apache/spark/pull/35239#issuecomment-1023960414
@huaxingao thanks again. fixed.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yutoacts commented on pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
yutoacts commented on pull request #35239:
URL: https://github.com/apache/spark/pull/35239#issuecomment-1033266754
@itholic thanks for the review.
@cloud-fan do you think examples are unnecessary for now?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yutoacts commented on pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
yutoacts commented on pull request #35239:
URL: https://github.com/apache/spark/pull/35239#issuecomment-1023877516
cc @huaxingao
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r793248260
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -75,6 +75,50 @@ ALTER TABLE table_identifier ADD COLUMNS ( col_spec [ , ... ] )
Specifies the columns to be added.
+### DROP COLUMNS
+
+`ALTER TABLE DROP COLUMNS` statement drops mentioned columns from an existing table.
+Note that this statement is only supported with v2 tables.
+
+
+#### Syntax
+
+```sql
+ALTER TABLE table_identifier DROP COLUMNS ( col_name1, ... )
+```
Review comment:
Here is the syntax:
```
| ALTER TABLE multipartIdentifier
DROP (COLUMN | COLUMNS)
'(' columns=multipartIdentifierList ')' #dropTableColumns
| ALTER TABLE multipartIdentifier
DROP (COLUMN | COLUMNS) columns=multipartIdentifierList #dropTableColumns
```
So I think it's something like this:
```
ALTER TABLE table_identifier DROP { COLUMN | COLUMNS } [ ( ] col_name [ , ... ] [ ) ]
```
I guess add a parameter in the below section for `col_name`.
You might want to change the add column syntax too to make it more accurate.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r793255964
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -309,6 +393,116 @@ DESC StudentInfo;
| age| int| NULL|
+-----------------------+---------+-------+
+-- Drop columns of a table
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| name| string| NULL|
+| rollno| int| NULL|
+| LastName| string| NULL|
+| DOB|timestamp| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+ALTER TABLE StudentInfo DROP columns (LastName, DOB);
+
+-- After dropping columns of the table
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| name| string| NULL|
+| rollno| int| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+-- Rename a column of a table
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| name| string| NULL|
+| rollno| int| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+ALTER TABLE StudentInfo RENAME COLUMN name TO FirstName;
+
+-- After renaming a column of the table
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| FirstName| string| NULL|
+| rollno| int| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+-- ALTER OR CHANGE COLUMNS
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| FirstName| string| NULL|
+| rollno| int| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+ALTER TABLE StudentInfo ALTER COLUMN FirstName COMMENT "new comment";
+
+--After ALTER or CHANGE COLUMNS
Review comment:
nit: space after `-`
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] HyukjinKwon commented on pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on pull request #35239:
URL: https://github.com/apache/spark/pull/35239#issuecomment-1015931592
cc @huaxingao FYI
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yutoacts commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
yutoacts commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r788421829
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -225,6 +294,25 @@ ALTER TABLE table_identifier [ partition_spec ] SET LOCATION 'new_location'
Specifies the SERDE properties to be set.
+### RECOVER PARTITIONS
+
+`RECOVER PARTITIONS` statement recovers all the partitions in the directory of a table and updates the Hive metastore.
Review comment:
thanks for the review. fixed.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r791564965
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -75,6 +75,54 @@ ALTER TABLE table_identifier ADD COLUMNS ( col_spec [ , ... ] )
Specifies the columns to be added.
+### DROP COLUMNS
+
+`ALTER TABLE DROP COLUMNS` statement drops mentioned columns of an existing table.
Review comment:
```suggestion
`ALTER TABLE DROP COLUMNS` statement drops mentioned columns from an existing table.
```
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -75,6 +75,54 @@ ALTER TABLE table_identifier ADD COLUMNS ( col_spec [ , ... ] )
Specifies the columns to be added.
+### DROP COLUMNS
+
+`ALTER TABLE DROP COLUMNS` statement drops mentioned columns of an existing table.
+Note that this statement is only supported with v2 tables.
Review comment:
ALTER COLUMN can't change column type but we don't mention it in the doc. I think it's OK to not mention the limitation here as well.
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -75,6 +75,54 @@ ALTER TABLE table_identifier ADD COLUMNS ( col_spec [ , ... ] )
Specifies the columns to be added.
+### DROP COLUMNS
+
+`ALTER TABLE DROP COLUMNS` statement drops mentioned columns of an existing table.
+Note that this statement is only supported with v2 tables.
+
+
+#### Syntax
+
+```sql
+ALTER TABLE table_identifier DROP COLUMNS ( col_spec [ , ... ] )
Review comment:
shouldn't DROP COLUMN only take column names?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r790524652
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -309,6 +397,116 @@ DESC StudentInfo;
| age| int| NULL|
+-----------------------+---------+-------+
+-- Drop columns of a table
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| name| string| NULL|
+| rollno| int| NULL|
+| LastName| string| NULL|
+| DOB|timestamp| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+ALTER TABLE StudentInfo DROP columns (LastName, DOB);
Review comment:
hmm, can users really run the example? AFAIK the builtin file sources do not support all the ALTER TABLE operations.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #35239:
URL: https://github.com/apache/spark/pull/35239#issuecomment-1021041302
@huaxingao can you review this first?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yutoacts commented on pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
yutoacts commented on pull request #35239:
URL: https://github.com/apache/spark/pull/35239#issuecomment-1027787558
@cloud-fan @itholic Could you review this? Thank you.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yutoacts commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
yutoacts commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r794195348
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -101,6 +145,27 @@ ALTER TABLE table_identifier { ALTER | CHANGE } [ COLUMN ] col_spec alterColumnA
Change column's definition.
+### REPLACE COLUMNS
+
+`ALTER TABLE REPLACE COLUMNS` statement removes all existing columns and adds the new set of columns.
+Note that this statement is only supported with v2 tables.
+
+
+#### Syntax
+
+```sql
+ALTER TABLE table_identifier REPLACE COLUMNS
+ [ ( col_name1 col_type1 [ COMMENT col_comment1 ], ... ) ]
+```
Review comment:
thanks for the review. fixed.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yutoacts commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
yutoacts commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r793553705
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -75,6 +75,50 @@ ALTER TABLE table_identifier ADD COLUMNS ( col_spec [ , ... ] )
Specifies the columns to be added.
+### DROP COLUMNS
+
+`ALTER TABLE DROP COLUMNS` statement drops mentioned columns from an existing table.
+Note that this statement is only supported with v2 tables.
+
+
+#### Syntax
+
+```sql
+ALTER TABLE table_identifier DROP COLUMNS ( col_name1, ... )
+```
Review comment:
Thanks for the review. It seems that `col_spec` is only used in this doc (for ADD COLUMN, RENAME COLUMN and ALTER/CHANGE COLUMN), and I agree with you that `col_spec` sounds misleading when only a name of a column is needed. I'll change all `col_spec` in `col_name` except ones in ADD COLUMN (since ADD COLUMN needs data type as well).
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yutoacts commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
yutoacts commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r793553705
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -75,6 +75,50 @@ ALTER TABLE table_identifier ADD COLUMNS ( col_spec [ , ... ] )
Specifies the columns to be added.
+### DROP COLUMNS
+
+`ALTER TABLE DROP COLUMNS` statement drops mentioned columns from an existing table.
+Note that this statement is only supported with v2 tables.
+
+
+#### Syntax
+
+```sql
+ALTER TABLE table_identifier DROP COLUMNS ( col_name1, ... )
+```
Review comment:
It seems that `col_spec` is only used in this doc (for ADD COLUMN, RENAME COLUMN and ALTER/CHANGE COLUMN), and I agree with you that `col_spec` sounds misleading when only a name of a column is needed. I'll change all `col_spec` in `col_name` except ones in ADD COLUMN (since ADD COLUMN needs data type as well).
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r794245742
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -137,9 +139,9 @@ ALTER TABLE table_identifier { ALTER | CHANGE } [ COLUMN ] col_spec alterColumnA
**Syntax:** `[ database_name. ] table_name`
-* **COLUMNS ( col_spec )**
+* **col_name**
- Specifies the column to be altered or be changed.
+ Specifies the name of the column to be renamed.
Review comment:
nit: delete `to be renamed`.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
huaxingao commented on pull request #35239:
URL: https://github.com/apache/spark/pull/35239#issuecomment-1016965975
@yutoacts Thanks for working on this! Could you please add some examples? Thanks!
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yutoacts commented on pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
yutoacts commented on pull request #35239:
URL: https://github.com/apache/spark/pull/35239#issuecomment-1017178500
@huaxingao thanks for the review. just added examples.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] itholic commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
itholic commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r788387632
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -225,6 +294,25 @@ ALTER TABLE table_identifier [ partition_spec ] SET LOCATION 'new_location'
Specifies the SERDE properties to be set.
+### RECOVER PARTITIONS
+
+`RECOVER PARTITIONS` statement recovers all the partitions in the directory of a table and updates the Hive metastore.
Review comment:
nit: maybe
```sql
`ALTER TABLE RECOVER PARTITIONS` statement blah blah...
```
to keep the consistency with other items ?
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -225,6 +294,25 @@ ALTER TABLE table_identifier [ partition_spec ] SET LOCATION 'new_location'
Specifies the SERDE properties to be set.
+### RECOVER PARTITIONS
+
+`RECOVER PARTITIONS` statement recovers all the partitions in the directory of a table and updates the Hive metastore.
Review comment:
nit: maybe
```sql
`ALTER TABLE RECOVER PARTITIONS` statement recovers blah blah...
```
to keep the consistency with other items ?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r794246767
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -95,16 +94,19 @@ ALTER TABLE table_identifier DROP COLUMNS ( col_name1, ... )
**Syntax:** `[ database_name. ] table_name`
+* **col_name**
+
+ Specifies the name of the column to be renamed.
Review comment:
nit: remove `to be renamed`
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #35239:
URL: https://github.com/apache/spark/pull/35239#issuecomment-1033559066
thanks, merging to master!
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yutoacts commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
yutoacts commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r791538241
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -309,6 +397,116 @@ DESC StudentInfo;
| age| int| NULL|
+-----------------------+---------+-------+
+-- Drop columns of a table
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| name| string| NULL|
+| rollno| int| NULL|
+| LastName| string| NULL|
+| DOB|timestamp| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+ALTER TABLE StudentInfo DROP columns (LastName, DOB);
Review comment:
@cloud-fan Thanks for the review. right, those statements I added except `RECOVER PARTITIONS` are not supported by builtin sources but users can technically use them with their custom file sources so I think they should be documented. I mentioned in a doc that they are only supported with v2 tables. Do you think they should not be in example?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yutoacts commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
yutoacts commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r791538241
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -309,6 +397,116 @@ DESC StudentInfo;
| age| int| NULL|
+-----------------------+---------+-------+
+-- Drop columns of a table
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| name| string| NULL|
+| rollno| int| NULL|
+| LastName| string| NULL|
+| DOB|timestamp| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+ALTER TABLE StudentInfo DROP columns (LastName, DOB);
Review comment:
@cloud-fan Thanks for the review. right, those statements I added except `RECOVER PARTITIONS` are not supported by builtin sources but users can technically use them by their custom file sources so I think they should be documented. I mentioned in a doc that they are only supported with v2 tables. Do you think they should not be in example?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r791573497
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -75,6 +75,54 @@ ALTER TABLE table_identifier ADD COLUMNS ( col_spec [ , ... ] )
Specifies the columns to be added.
+### DROP COLUMNS
+
+`ALTER TABLE DROP COLUMNS` statement drops mentioned columns of an existing table.
+Note that this statement is only supported with v2 tables.
Review comment:
ALTER COLUMN can't change column type but we don't mention it in the doc. I think it's OK to not mention the limitation here as well.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #35239: [SPARK-37952][DOCS] Add missing statements to ALTER TABLE document
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r793252862
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -75,6 +75,50 @@ ALTER TABLE table_identifier ADD COLUMNS ( col_spec [ , ... ] )
Specifies the columns to be added.
+### DROP COLUMNS
+
+`ALTER TABLE DROP COLUMNS` statement drops mentioned columns from an existing table.
+Note that this statement is only supported with v2 tables.
+
+
+#### Syntax
+
+```sql
+ALTER TABLE table_identifier DROP COLUMNS ( col_name1, ... )
+```
Review comment:
I just realized that previously we used `col_spec` for add column. I think `col_name` is more accurate, because `col_spec` makes me think it is column name + data type. Could you please check if other doc use `col_spec` too? If yes, we probably want to use `col_spec` to be consistent.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org