From 24122ddefa7a976c7b2243f16b2914e4162e9350 Mon Sep 17 00:00:00 2001 From: shivusondur Date: Wed, 21 Aug 2019 14:48:08 +0530 Subject: [PATCH 01/10] Added doc --- docs/sql-ref-syntax-ddl-drop-table.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/sql-ref-syntax-ddl-drop-table.md b/docs/sql-ref-syntax-ddl-drop-table.md index a036e66c3906..d8d6469927ac 100644 --- a/docs/sql-ref-syntax-ddl-drop-table.md +++ b/docs/sql-ref-syntax-ddl-drop-table.md @@ -19,4 +19,20 @@ license: | limitations under the License. --- -**This page is under construction** +### Description +Drop a table and delete the directory associated with the table from the file system if this is not an +EXTERNAL table. If the table to drop does not exist, an exception is thrown. + +### Syntax +{% highlight sql %} +DROP TABLE [IF EXISTS] [database_name.]table_name +{% endhighlight %} + + ### Example +{% highlight sql %} +DROP TABLE USERDB.TABLE1 +DROP TABLE TABLE1 +DROP TABLE IF EXISTS USERDB.TABLE1 +DROP TABLE IF EXISTS TABLE1 +{% endhighlight %} + From a1fb4cfe991ec3a8b0c03e2fe7edc931b13f6a3b Mon Sep 17 00:00:00 2001 From: shivusondur Date: Wed, 21 Aug 2019 15:07:00 +0530 Subject: [PATCH 02/10] ADDED THE VIEW DOC --- docs/sql-ref-syntax-ddl-drop-view.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/sql-ref-syntax-ddl-drop-view.md b/docs/sql-ref-syntax-ddl-drop-view.md index 9ad22500fd9e..ee955c18c1c9 100644 --- a/docs/sql-ref-syntax-ddl-drop-view.md +++ b/docs/sql-ref-syntax-ddl-drop-view.md @@ -19,4 +19,21 @@ license: | limitations under the License. --- -**This page is under construction** +### Description +Drops the specified view, which was created by the CREATE VIEW statement. Because a view +is purely a logical construct with no physical data behind it, DROP VIEW only +involves changes to metadata in the metastore database, not any data files in HDFS. + +### Syntax +{% highlight sql %} +DROP VIEW [IF EXISTS] [database_name.]view_name +{% endhighlight %} + + ### Example +{% highlight sql %} +DROP VIEW USERDB.VIEW1 +DROP TABLE VIEW1 +DROP VIEW IF EXISTS USERDB.VIEW1 +DROP VIEW IF EXISTS VIEW1 +{% endhighlight %} + From 3b4252e9d12092365ac043b62ca2629fc79db242 Mon Sep 17 00:00:00 2001 From: shivusondur Date: Fri, 23 Aug 2019 04:58:59 +0530 Subject: [PATCH 03/10] Updated the document details --- docs/sql-ref-syntax-ddl-drop-table.md | 35 +++++++++++++++++++++------ 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/docs/sql-ref-syntax-ddl-drop-table.md b/docs/sql-ref-syntax-ddl-drop-table.md index d8d6469927ac..1f9b3f874e53 100644 --- a/docs/sql-ref-syntax-ddl-drop-table.md +++ b/docs/sql-ref-syntax-ddl-drop-table.md @@ -20,19 +20,38 @@ license: | --- ### Description -Drop a table and delete the directory associated with the table from the file system if this is not an -EXTERNAL table. If the table to drop does not exist, an exception is thrown. +Removes the table and corresponding directory associated with table from the file system if current +table is not an external table. +If the table to be dropped does not exist, an exception is thrown. ### Syntax {% highlight sql %} -DROP TABLE [IF EXISTS] [database_name.]table_name +DROP TABLE [IF EXISTS] [dbname.]tableName {% endhighlight %} - ### Example +### Parameter + +**dbname** + +Database name where table present, if not provided it takes the current Database. + +**tableName** + +Table to be dropped + +**IF EXISTS** + +If specified will not throw exception if table is not present. + + +### Example {% highlight sql %} -DROP TABLE USERDB.TABLE1 -DROP TABLE TABLE1 -DROP TABLE IF EXISTS USERDB.TABLE1 -DROP TABLE IF EXISTS TABLE1 +DROP TABLE USERDB.USERTABLE +DROP TABLE USERTABLE +DROP TABLE IF EXISTS USERDB.USERTABLE +DROP TABLE IF EXISTS USERTABLE {% endhighlight %} + + + From 42cda3e0eca43ab3fa46e6df862e8fdb70dfd901 Mon Sep 17 00:00:00 2001 From: shivusondur Date: Fri, 23 Aug 2019 05:18:51 +0530 Subject: [PATCH 04/10] Updated the document details --- docs/sql-ref-syntax-ddl-drop-table.md | 7 +++--- docs/sql-ref-syntax-ddl-drop-view.md | 31 +++++++++++++++++++-------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/docs/sql-ref-syntax-ddl-drop-table.md b/docs/sql-ref-syntax-ddl-drop-table.md index 1f9b3f874e53..7bd9e1b026b1 100644 --- a/docs/sql-ref-syntax-ddl-drop-table.md +++ b/docs/sql-ref-syntax-ddl-drop-table.md @@ -22,7 +22,6 @@ license: | ### Description Removes the table and corresponding directory associated with table from the file system if current table is not an external table. -If the table to be dropped does not exist, an exception is thrown. ### Syntax {% highlight sql %} @@ -33,15 +32,15 @@ DROP TABLE [IF EXISTS] [dbname.]tableName **dbname** -Database name where table present, if not provided it takes the current Database. +*Database* name where table present, if not provided it takes the current *Database*. **tableName** -Table to be dropped +*Table* to be dropped **IF EXISTS** -If specified will not throw exception if table is not present. +If specified will not throw exception if *table* is not present. ### Example diff --git a/docs/sql-ref-syntax-ddl-drop-view.md b/docs/sql-ref-syntax-ddl-drop-view.md index ee955c18c1c9..ec8a6a278202 100644 --- a/docs/sql-ref-syntax-ddl-drop-view.md +++ b/docs/sql-ref-syntax-ddl-drop-view.md @@ -20,20 +20,33 @@ license: | --- ### Description -Drops the specified view, which was created by the CREATE VIEW statement. Because a view -is purely a logical construct with no physical data behind it, DROP VIEW only -involves changes to metadata in the metastore database, not any data files in HDFS. +Removes the view, which was created by CREATE VIEW statement. DROP VIEW only involves +changes in metadata in the metastore database. ### Syntax {% highlight sql %} -DROP VIEW [IF EXISTS] [database_name.]view_name +DROP VIEW [IF EXISTS] [dbname.]viewName {% endhighlight %} - ### Example +### Parameter + +**dbname** + +*Database* name where view present, if not provided it takes the *current Database*. + +**viewName** + +*View* to be dropped + +**IF EXISTS** + +If specified will not throw exception if *view* is not present. + +### Example {% highlight sql %} -DROP VIEW USERDB.VIEW1 -DROP TABLE VIEW1 -DROP VIEW IF EXISTS USERDB.VIEW1 -DROP VIEW IF EXISTS VIEW1 +DROP VIEW USERDB.USERVIEW +DROP TABLE USERVIEW +DROP VIEW IF EXISTS USERDB.USERVIEW +DROP VIEW IF EXISTS USERVIEW {% endhighlight %} From 5683d95553ccad8440ee520c16e93d20ddf3a704 Mon Sep 17 00:00:00 2001 From: shivusondur Date: Mon, 2 Sep 2019 12:47:52 +0530 Subject: [PATCH 05/10] Updated the document according to latest comments --- docs/sql-ref-syntax-ddl-drop-table.md | 70 +++++++++++++++++++-------- 1 file changed, 51 insertions(+), 19 deletions(-) diff --git a/docs/sql-ref-syntax-ddl-drop-table.md b/docs/sql-ref-syntax-ddl-drop-table.md index 7bd9e1b026b1..b9cb2c3bece3 100644 --- a/docs/sql-ref-syntax-ddl-drop-table.md +++ b/docs/sql-ref-syntax-ddl-drop-table.md @@ -20,37 +20,69 @@ license: | --- ### Description -Removes the table and corresponding directory associated with table from the file system if current -table is not an external table. + +Deletes the table and removes the directory associated with this table from the file system if this +is not EXTERNAL table. If the table is not present it throws exception. + +In case of External table it only deletes the metadata and it will not remove the directory +associated with this table. ### Syntax {% highlight sql %} -DROP TABLE [IF EXISTS] [dbname.]tableName +DROP TABLE [IF EXISTS] [database_name.]table_name {% endhighlight %} ### Parameter +
+
IF EXISTS
+
+ If specified, no exception is thrown when the table does not exist. +
+
database_name
+
+ Database name where table is present. +
+
table_name
+
+ table name to be dropped. +
+
-**dbname** - -*Database* name where table present, if not provided it takes the current *Database*. - -**tableName** - -*Table* to be dropped +### Example +{% highlight sql %} +-- Assumes a table name `employeetable` exist. +DROP TABLE employeetable; ++---------+--+ +| Result | ++---------+--+ ++---------+--+ -**IF EXISTS** +-- Assumes a table name `employeetable` exist in `userdb` database +DROP TABLE userdb.employeetable; ++---------+--+ +| Result | ++---------+--+ ++---------+--+ -If specified will not throw exception if *table* is not present. +-- Assumes a table name `employeetable` does not exist. +-- Throws exception +DROP TABLE employeetable; +Error: org.apache.spark.sql.AnalysisException: Table or view not found: employeetable; +(state=,code=0) +-- Assumes a table name `employeetable` does not exist,Try with IF EXISTS +-- this time it will not throw exception +DROP TABLE IF EXISTS employeetable; ++---------+--+ +| Result | ++---------+--+ ++---------+--+ -### Example -{% highlight sql %} -DROP TABLE USERDB.USERTABLE -DROP TABLE USERTABLE -DROP TABLE IF EXISTS USERDB.USERTABLE -DROP TABLE IF EXISTS USERTABLE {% endhighlight %} - +### Related Statements +- [CREATE TABLE ](sql-ref-syntax-ddl-create-table.html) +- [CREATE DATABASE](sql-ref-syntax-ddl-create-database.html) +- [DROP DATABASE](sql-ref-syntax-ddl-drop-database.html) From 4ee7a76fe6ac6c267ed016362c0e7146dcfa540b Mon Sep 17 00:00:00 2001 From: shivusondur Date: Mon, 2 Sep 2019 12:51:21 +0530 Subject: [PATCH 06/10] Updated the document according to latest comments --- docs/sql-ref-syntax-ddl-drop-table.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sql-ref-syntax-ddl-drop-table.md b/docs/sql-ref-syntax-ddl-drop-table.md index b9cb2c3bece3..79cc26f60ddb 100644 --- a/docs/sql-ref-syntax-ddl-drop-table.md +++ b/docs/sql-ref-syntax-ddl-drop-table.md @@ -22,7 +22,7 @@ license: | ### Description Deletes the table and removes the directory associated with this table from the file system if this -is not EXTERNAL table. If the table is not present it throws exception. +is not `EXTERNAL` table. If the table is not present it throws exception. In case of External table it only deletes the metadata and it will not remove the directory associated with this table. From c1710400f420f661432127fa856be7548544e2b6 Mon Sep 17 00:00:00 2001 From: shivusondur Date: Mon, 2 Sep 2019 13:44:20 +0530 Subject: [PATCH 07/10] Updated the document according to latest comments --- docs/sql-ref-syntax-ddl-drop-table.md | 6 +-- docs/sql-ref-syntax-ddl-drop-view.md | 64 ++++++++++++++++++++------- 2 files changed, 50 insertions(+), 20 deletions(-) diff --git a/docs/sql-ref-syntax-ddl-drop-table.md b/docs/sql-ref-syntax-ddl-drop-table.md index 79cc26f60ddb..8fe1aee1fe19 100644 --- a/docs/sql-ref-syntax-ddl-drop-table.md +++ b/docs/sql-ref-syntax-ddl-drop-table.md @@ -21,10 +21,10 @@ license: | ### Description -Deletes the table and removes the directory associated with this table from the file system if this -is not `EXTERNAL` table. If the table is not present it throws exception. +Deletes the table and removes the directory associated with this table from the file system +if this is not `EXTERNAL` table. If the table is not present it throws exception. -In case of External table it only deletes the metadata and it will not remove the directory +In case of External table it only deletes the metadata from metastore database and it will not remove the directory associated with this table. ### Syntax diff --git a/docs/sql-ref-syntax-ddl-drop-view.md b/docs/sql-ref-syntax-ddl-drop-view.md index ec8a6a278202..6b6c724c18bb 100644 --- a/docs/sql-ref-syntax-ddl-drop-view.md +++ b/docs/sql-ref-syntax-ddl-drop-view.md @@ -20,33 +20,63 @@ license: | --- ### Description -Removes the view, which was created by CREATE VIEW statement. DROP VIEW only involves -changes in metadata in the metastore database. +Drops the specified `VIEW`, which was created by `CREATE VIEW` statement. `DROP VIEW` only involves +changes in metadata from the metastore database. ### Syntax {% highlight sql %} -DROP VIEW [IF EXISTS] [dbname.]viewName +DROP VIEW [IF EXISTS] [database_name.]view_name {% endhighlight %} ### Parameter +
+
IF EXISTS
+
+ If specified, no exception is thrown when the view does not exist. +
+
database_name
+
+ Database name where view is present. +
+
view_name
+
+ view name to be dropped. +
+
-**dbname** - -*Database* name where view present, if not provided it takes the *current Database*. - -**viewName** +### Example +{% highlight sql %} +-- Assumes a view name `employeeView` exist. +DROP VIEW employeeView; ++---------+--+ +| Result | ++---------+--+ ++---------+--+ -*View* to be dropped +-- Assumes a view name `employeeView` exist in `userdb` database +DROP VIEW userdb.employeeView; ++---------+--+ +| Result | ++---------+--+ ++---------+--+ -**IF EXISTS** +-- Assumes a view name `employeeView` does not exist. +-- Throws exception +DROP VIEW employeeView; +Error: org.apache.spark.sql.AnalysisException: Table or view not found: employeeView; +(state=,code=0) -If specified will not throw exception if *view* is not present. +-- Assumes a view name `employeeView` does not exist,Try with IF EXISTS +-- this time it will not throw exception +DROP VIEW IF EXISTS employeeView; ++---------+--+ +| Result | ++---------+--+ ++---------+--+ -### Example -{% highlight sql %} -DROP VIEW USERDB.USERVIEW -DROP TABLE USERVIEW -DROP VIEW IF EXISTS USERDB.USERVIEW -DROP VIEW IF EXISTS USERVIEW {% endhighlight %} +### Related Statements +- [CREATE VIEW ](sql-ref-syntax-ddl-create-view.html) +- [CREATE DATABASE](sql-ref-syntax-ddl-create-database.html) +- [DROP DATABASE](sql-ref-syntax-ddl-drop-database.html) From 194a0b09a29c313be6180f29415d3360ab5fd86e Mon Sep 17 00:00:00 2001 From: shivusondur Date: Tue, 17 Sep 2019 23:50:30 +0530 Subject: [PATCH 08/10] Handled the dilipbiswal's comments Handled PR according to #25523 PR which is already merged. to make uniform accross all docs --- docs/sql-ref-syntax-ddl-drop-table.md | 9 ++++----- docs/sql-ref-syntax-ddl-drop-view.md | 7 +++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/docs/sql-ref-syntax-ddl-drop-table.md b/docs/sql-ref-syntax-ddl-drop-table.md index 8fe1aee1fe19..c62ee90f0b6b 100644 --- a/docs/sql-ref-syntax-ddl-drop-table.md +++ b/docs/sql-ref-syntax-ddl-drop-table.md @@ -22,10 +22,9 @@ license: | ### Description Deletes the table and removes the directory associated with this table from the file system -if this is not `EXTERNAL` table. If the table is not present it throws exception. +if this is not `EXTERNAL` table. If the table is not present it throws an exception. -In case of External table it only deletes the metadata from metastore database and it will not remove the directory -associated with this table. +In case of External table, only the associated metadata information are removed from the metastore database. ### Syntax {% highlight sql %} @@ -40,11 +39,11 @@ DROP TABLE [IF EXISTS] [database_name.]table_name
database_name
- Database name where table is present. + Specifies the database name where table is present.
table_name
- table name to be dropped. + Specifies the table name to be dropped.
diff --git a/docs/sql-ref-syntax-ddl-drop-view.md b/docs/sql-ref-syntax-ddl-drop-view.md index 6b6c724c18bb..a6eb0516547a 100644 --- a/docs/sql-ref-syntax-ddl-drop-view.md +++ b/docs/sql-ref-syntax-ddl-drop-view.md @@ -20,8 +20,7 @@ license: | --- ### Description -Drops the specified `VIEW`, which was created by `CREATE VIEW` statement. `DROP VIEW` only involves -changes in metadata from the metastore database. +DROP VIEW removes the metadata associated with a specified view from the catalog. ### Syntax {% highlight sql %} @@ -36,11 +35,11 @@ DROP VIEW [IF EXISTS] [database_name.]view_name
database_name
- Database name where view is present. + Specifies the database name where view is present.
view_name
- view name to be dropped. + Specifies the view name to be dropped.
From df23c952bbf27ce1a637370cf62d58526389473f Mon Sep 17 00:00:00 2001 From: shivusondur Date: Wed, 30 Oct 2019 00:01:18 +0530 Subject: [PATCH 09/10] handled the comments --- docs/sql-ref-syntax-ddl-drop-table.md | 16 ++++++++-------- docs/sql-ref-syntax-ddl-drop-view.md | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/sql-ref-syntax-ddl-drop-table.md b/docs/sql-ref-syntax-ddl-drop-table.md index c62ee90f0b6b..1c94c0ff202c 100644 --- a/docs/sql-ref-syntax-ddl-drop-table.md +++ b/docs/sql-ref-syntax-ddl-drop-table.md @@ -21,10 +21,10 @@ license: | ### Description -Deletes the table and removes the directory associated with this table from the file system +`DROP TABLE` deletes the table and removes the directory associated with this table from the file system if this is not `EXTERNAL` table. If the table is not present it throws an exception. -In case of External table, only the associated metadata information are removed from the metastore database. +In case of an external table, only the associated metadata information are removed from the metastore database. ### Syntax {% highlight sql %} @@ -35,7 +35,7 @@ DROP TABLE [IF EXISTS] [database_name.]table_name
IF EXISTS
- If specified, no exception is thrown when the table does not exist. + If specified, no exception is thrown when the table does not exists.
database_name
@@ -49,27 +49,27 @@ DROP TABLE [IF EXISTS] [database_name.]table_name ### Example {% highlight sql %} --- Assumes a table name `employeetable` exist. +-- Assumes a table named `employeetable` exists. DROP TABLE employeetable; +---------+--+ | Result | +---------+--+ +---------+--+ --- Assumes a table name `employeetable` exist in `userdb` database +-- Assumes a table named `employeetable` exists in the `userdb` database DROP TABLE userdb.employeetable; +---------+--+ | Result | +---------+--+ +---------+--+ --- Assumes a table name `employeetable` does not exist. +-- Assumes a table named `employeetable` does not exists. -- Throws exception DROP TABLE employeetable; Error: org.apache.spark.sql.AnalysisException: Table or view not found: employeetable; (state=,code=0) --- Assumes a table name `employeetable` does not exist,Try with IF EXISTS +-- Assumes a table named `employeetable` does not exists,Try with IF EXISTS -- this time it will not throw exception DROP TABLE IF EXISTS employeetable; +---------+--+ @@ -80,7 +80,7 @@ DROP TABLE IF EXISTS employeetable; {% endhighlight %} ### Related Statements -- [CREATE TABLE ](sql-ref-syntax-ddl-create-table.html) +- [CREATE TABLE](sql-ref-syntax-ddl-create-table.html) - [CREATE DATABASE](sql-ref-syntax-ddl-create-database.html) - [DROP DATABASE](sql-ref-syntax-ddl-drop-database.html) diff --git a/docs/sql-ref-syntax-ddl-drop-view.md b/docs/sql-ref-syntax-ddl-drop-view.md index a6eb0516547a..f095a3456772 100644 --- a/docs/sql-ref-syntax-ddl-drop-view.md +++ b/docs/sql-ref-syntax-ddl-drop-view.md @@ -20,7 +20,7 @@ license: | --- ### Description -DROP VIEW removes the metadata associated with a specified view from the catalog. +`DROP VIEW` removes the metadata associated with a specified view from the catalog. ### Syntax {% highlight sql %} @@ -31,7 +31,7 @@ DROP VIEW [IF EXISTS] [database_name.]view_name
IF EXISTS
- If specified, no exception is thrown when the view does not exist. + If specified, no exception is thrown when the view does not exists.
database_name
@@ -45,27 +45,27 @@ DROP VIEW [IF EXISTS] [database_name.]view_name ### Example {% highlight sql %} --- Assumes a view name `employeeView` exist. +-- Assumes a view named `employeeView` exists. DROP VIEW employeeView; +---------+--+ | Result | +---------+--+ +---------+--+ --- Assumes a view name `employeeView` exist in `userdb` database +-- Assumes a view named `employeeView` exists in the `userdb` database DROP VIEW userdb.employeeView; +---------+--+ | Result | +---------+--+ +---------+--+ --- Assumes a view name `employeeView` does not exist. +-- Assumes a view named `employeeView` does not exists. -- Throws exception DROP VIEW employeeView; Error: org.apache.spark.sql.AnalysisException: Table or view not found: employeeView; (state=,code=0) --- Assumes a view name `employeeView` does not exist,Try with IF EXISTS +-- Assumes a view named `employeeView` does not exists,Try with IF EXISTS -- this time it will not throw exception DROP VIEW IF EXISTS employeeView; +---------+--+ @@ -76,6 +76,6 @@ DROP VIEW IF EXISTS employeeView; {% endhighlight %} ### Related Statements -- [CREATE VIEW ](sql-ref-syntax-ddl-create-view.html) +- [CREATE VIEW](sql-ref-syntax-ddl-create-view.html) - [CREATE DATABASE](sql-ref-syntax-ddl-create-database.html) - [DROP DATABASE](sql-ref-syntax-ddl-drop-database.html) From 2ca9a6e149c545d854c951c198c7a283c8ceb434 Mon Sep 17 00:00:00 2001 From: shivusondur Date: Wed, 30 Oct 2019 23:16:30 +0530 Subject: [PATCH 10/10] handled the comments --- docs/sql-ref-syntax-ddl-drop-table.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/sql-ref-syntax-ddl-drop-table.md b/docs/sql-ref-syntax-ddl-drop-table.md index 1c94c0ff202c..f9129d5114fa 100644 --- a/docs/sql-ref-syntax-ddl-drop-table.md +++ b/docs/sql-ref-syntax-ddl-drop-table.md @@ -21,10 +21,10 @@ license: | ### Description -`DROP TABLE` deletes the table and removes the directory associated with this table from the file system -if this is not `EXTERNAL` table. If the table is not present it throws an exception. +`DROP TABLE` deletes the table and removes the directory associated with the table from the file system +if the table is not `EXTERNAL` table. If the table is not present it throws an exception. -In case of an external table, only the associated metadata information are removed from the metastore database. +In case of an external table, only the associated metadata information is removed from the metastore database. ### Syntax {% highlight sql %}