[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user asfgit closed the pull request at: https://github.com/apache/spark/pull/12324 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user yhuai commented on the pull request: https://github.com/apache/spark/pull/12324#issuecomment-209991009 Thanks. Merging to master. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user AmplabJenkins commented on the pull request: https://github.com/apache/spark/pull/12324#issuecomment-209965658 Test PASSed. Refer to this link for build results (access rights to CI server needed): https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/55815/ Test PASSed. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user AmplabJenkins commented on the pull request: https://github.com/apache/spark/pull/12324#issuecomment-209965650 Merged build finished. Test PASSed. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user SparkQA commented on the pull request: https://github.com/apache/spark/pull/12324#issuecomment-209965062 **[Test build #55815 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/55815/consoleFull)** for PR 12324 at commit [`db7f931`](https://github.com/apache/spark/commit/db7f9314bc72a85a157debd70012f0f2fce70a05). * This patch passes all tests. * This patch merges cleanly. * This patch adds no public classes. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user SparkQA commented on the pull request: https://github.com/apache/spark/pull/12324#issuecomment-209922929 **[Test build #55815 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/55815/consoleFull)** for PR 12324 at commit [`db7f931`](https://github.com/apache/spark/commit/db7f9314bc72a85a157debd70012f0f2fce70a05). --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/12324#discussion_r59709820 --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala --- @@ -131,6 +131,124 @@ class HiveDDLSuite extends QueryTest with SQLTestUtils with TestHiveSingleton { } } + test("alter views - rename") { +val tabName = "tab1" +withTable(tabName) { + sqlContext.range(10).write.saveAsTable(tabName) + val oldViewName = "view1" + val newViewName = "view2" + withView(oldViewName, newViewName) { +val catalog = hiveContext.sessionState.catalog +sql(s"CREATE VIEW $oldViewName AS SELECT * FROM $tabName") + +assert(catalog.tableExists(TableIdentifier(oldViewName))) +assert(!catalog.tableExists(TableIdentifier(newViewName))) +sql(s"ALTER VIEW $oldViewName RENAME TO $newViewName") +assert(!catalog.tableExists(TableIdentifier(oldViewName))) +assert(catalog.tableExists(TableIdentifier(newViewName))) + +sql(s"DROP VIEW $newViewName") --- End diff -- Sure, remove it now. Thanks! --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user cloud-fan commented on the pull request: https://github.com/apache/spark/pull/12324#issuecomment-209829717 LGTM except some minor comments --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/12324#discussion_r59680447 --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala --- @@ -131,6 +131,124 @@ class HiveDDLSuite extends QueryTest with SQLTestUtils with TestHiveSingleton { } } + test("alter views - rename") { +val tabName = "tab1" +withTable(tabName) { + sqlContext.range(10).write.saveAsTable(tabName) + val oldViewName = "view1" + val newViewName = "view2" + withView(oldViewName, newViewName) { +val catalog = hiveContext.sessionState.catalog +sql(s"CREATE VIEW $oldViewName AS SELECT * FROM $tabName") + +assert(catalog.tableExists(TableIdentifier(oldViewName))) +assert(!catalog.tableExists(TableIdentifier(newViewName))) +sql(s"ALTER VIEW $oldViewName RENAME TO $newViewName") +assert(!catalog.tableExists(TableIdentifier(oldViewName))) +assert(catalog.tableExists(TableIdentifier(newViewName))) + +sql(s"DROP VIEW $newViewName") + } +} + } + + test("alter views - set/unset tblproperties") { +val tabName = "tab1" +withTable(tabName) { + sqlContext.range(10).write.saveAsTable(tabName) + val viewName = "view1" + withView(viewName) { +val catalog = hiveContext.sessionState.catalog +sql(s"CREATE VIEW $viewName AS SELECT * FROM $tabName") + +assert(catalog.getTableMetadata(TableIdentifier(viewName)) + .properties.filter(_._1 != "transient_lastDdlTime") == Map()) +sql(s"ALTER VIEW $viewName SET TBLPROPERTIES ('p' = 'an')") +assert(catalog.getTableMetadata(TableIdentifier(viewName)) + .properties.filter(_._1 != "transient_lastDdlTime") == Map("p" -> "an")) + +// no exception or message will be issued if we set it again +sql(s"ALTER VIEW $viewName SET TBLPROPERTIES ('p' = 'an')") +assert(catalog.getTableMetadata(TableIdentifier(viewName)) + .properties.filter(_._1 != "transient_lastDdlTime") == Map("p" -> "an")) + +// the value will be updated if we set the same key to a different value +sql(s"ALTER VIEW $viewName SET TBLPROPERTIES ('p' = 'b')") +assert(catalog.getTableMetadata(TableIdentifier(viewName)) + .properties.filter(_._1 != "transient_lastDdlTime") == Map("p" -> "b")) + +sql(s"ALTER VIEW $viewName UNSET TBLPROPERTIES ('p')") +assert(catalog.getTableMetadata(TableIdentifier(viewName)) + .properties.filter(_._1 != "transient_lastDdlTime") == Map()) + +val message = intercept[AnalysisException] { + sql(s"ALTER VIEW $viewName UNSET TBLPROPERTIES ('p')") +}.getMessage +assert(message.contains( + "attempted to unset non-existent property 'p' in table '`view1`'")) + +sql(s"DROP VIEW $viewName") + } +} + } + + test("alter views and alter table - misuse") { +val tabName = "tab1" +withTable(tabName) { + sqlContext.range(10).write.saveAsTable(tabName) + val oldViewName = "view1" + val newViewName = "view2" + withView(oldViewName, newViewName) { +val catalog = hiveContext.sessionState.catalog +sql(s"CREATE VIEW $oldViewName AS SELECT * FROM $tabName") + +assert(catalog.tableExists(TableIdentifier(tabName))) +assert(catalog.tableExists(TableIdentifier(oldViewName))) + +var message = intercept[AnalysisException] { + sql(s"ALTER VIEW $tabName RENAME TO $newViewName") +}.getMessage +assert(message.contains( + "Cannot alter a table with ALTER VIEW. Please use ALTER TABLE instead")) + +message = intercept[AnalysisException] { + sql(s"ALTER VIEW $tabName SET TBLPROPERTIES ('p' = 'an')") +}.getMessage +assert(message.contains( + "Cannot alter a table with ALTER VIEW. Please use ALTER TABLE instead")) + +message = intercept[AnalysisException] { + sql(s"ALTER VIEW $tabName UNSET TBLPROPERTIES ('p')") +}.getMessage +assert(message.contains( + "Cannot alter a table with ALTER VIEW. Please use ALTER TABLE instead")) + +message = intercept[AnalysisException] { + sql(s"ALTER TABLE $oldViewName RENAME TO $newViewName") +}.getMessage +assert(message.contains( + "Cannot alter a view with ALTER TABLE. Please use ALTER VIEW instead")) + +message = intercept[AnalysisException] { + sql
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/12324#discussion_r59680300 --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala --- @@ -131,6 +131,124 @@ class HiveDDLSuite extends QueryTest with SQLTestUtils with TestHiveSingleton { } } + test("alter views - rename") { +val tabName = "tab1" +withTable(tabName) { + sqlContext.range(10).write.saveAsTable(tabName) + val oldViewName = "view1" + val newViewName = "view2" + withView(oldViewName, newViewName) { +val catalog = hiveContext.sessionState.catalog +sql(s"CREATE VIEW $oldViewName AS SELECT * FROM $tabName") + +assert(catalog.tableExists(TableIdentifier(oldViewName))) +assert(!catalog.tableExists(TableIdentifier(newViewName))) +sql(s"ALTER VIEW $oldViewName RENAME TO $newViewName") +assert(!catalog.tableExists(TableIdentifier(oldViewName))) +assert(catalog.tableExists(TableIdentifier(newViewName))) + +sql(s"DROP VIEW $newViewName") + } +} + } + + test("alter views - set/unset tblproperties") { +val tabName = "tab1" +withTable(tabName) { + sqlContext.range(10).write.saveAsTable(tabName) + val viewName = "view1" + withView(viewName) { +val catalog = hiveContext.sessionState.catalog +sql(s"CREATE VIEW $viewName AS SELECT * FROM $tabName") + +assert(catalog.getTableMetadata(TableIdentifier(viewName)) + .properties.filter(_._1 != "transient_lastDdlTime") == Map()) +sql(s"ALTER VIEW $viewName SET TBLPROPERTIES ('p' = 'an')") +assert(catalog.getTableMetadata(TableIdentifier(viewName)) + .properties.filter(_._1 != "transient_lastDdlTime") == Map("p" -> "an")) + +// no exception or message will be issued if we set it again +sql(s"ALTER VIEW $viewName SET TBLPROPERTIES ('p' = 'an')") +assert(catalog.getTableMetadata(TableIdentifier(viewName)) + .properties.filter(_._1 != "transient_lastDdlTime") == Map("p" -> "an")) + +// the value will be updated if we set the same key to a different value +sql(s"ALTER VIEW $viewName SET TBLPROPERTIES ('p' = 'b')") +assert(catalog.getTableMetadata(TableIdentifier(viewName)) + .properties.filter(_._1 != "transient_lastDdlTime") == Map("p" -> "b")) + +sql(s"ALTER VIEW $viewName UNSET TBLPROPERTIES ('p')") +assert(catalog.getTableMetadata(TableIdentifier(viewName)) + .properties.filter(_._1 != "transient_lastDdlTime") == Map()) + +val message = intercept[AnalysisException] { + sql(s"ALTER VIEW $viewName UNSET TBLPROPERTIES ('p')") +}.getMessage +assert(message.contains( + "attempted to unset non-existent property 'p' in table '`view1`'")) + +sql(s"DROP VIEW $viewName") --- End diff -- here too --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/12324#discussion_r59679386 --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala --- @@ -131,6 +131,124 @@ class HiveDDLSuite extends QueryTest with SQLTestUtils with TestHiveSingleton { } } + test("alter views - rename") { +val tabName = "tab1" +withTable(tabName) { + sqlContext.range(10).write.saveAsTable(tabName) + val oldViewName = "view1" + val newViewName = "view2" + withView(oldViewName, newViewName) { +val catalog = hiveContext.sessionState.catalog +sql(s"CREATE VIEW $oldViewName AS SELECT * FROM $tabName") + +assert(catalog.tableExists(TableIdentifier(oldViewName))) +assert(!catalog.tableExists(TableIdentifier(newViewName))) +sql(s"ALTER VIEW $oldViewName RENAME TO $newViewName") +assert(!catalog.tableExists(TableIdentifier(oldViewName))) +assert(catalog.tableExists(TableIdentifier(newViewName))) + +sql(s"DROP VIEW $newViewName") --- End diff -- `withView` will help us drop the view at last. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user AmplabJenkins commented on the pull request: https://github.com/apache/spark/pull/12324#issuecomment-209740750 Merged build finished. Test PASSed. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user SparkQA commented on the pull request: https://github.com/apache/spark/pull/12324#issuecomment-209740635 **[Test build #55782 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/55782/consoleFull)** for PR 12324 at commit [`e82aa47`](https://github.com/apache/spark/commit/e82aa477c9720c54ab847f76ffde357c63e821a1). * This patch passes all tests. * This patch merges cleanly. * This patch adds no public classes. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user AmplabJenkins commented on the pull request: https://github.com/apache/spark/pull/12324#issuecomment-209740752 Test PASSed. Refer to this link for build results (access rights to CI server needed): https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/55782/ Test PASSed. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user SparkQA commented on the pull request: https://github.com/apache/spark/pull/12324#issuecomment-209722365 **[Test build #55782 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/55782/consoleFull)** for PR 12324 at commit [`e82aa47`](https://github.com/apache/spark/commit/e82aa477c9720c54ab847f76ffde357c63e821a1). --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/12324#discussion_r59654766 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala --- @@ -232,16 +232,17 @@ case class DropTable( */ case class AlterTableRename( oldName: TableIdentifier, -newName: TableIdentifier) +newName: TableIdentifier, +isView: Boolean) extends RunnableCommand { override def run(sqlContext: SQLContext): Seq[Row] = { val catalog = sqlContext.sessionState.catalog +DDLUtils.verifyAlterTableOrAlterView(catalog, oldName, isView) catalog.invalidateTable(oldName) catalog.renameTable(oldName, newName) Seq.empty[Row] } - --- End diff -- Ok, I see. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/12324#discussion_r59654739 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala --- @@ -533,5 +538,23 @@ private object DDLUtils { def isDatasourceTable(table: CatalogTable): Boolean = { isDatasourceTable(table.properties) } + + // If the command ALTER VIEW is to alter a table or ALTER TABLE is to alter a view, + // issue an exception. + @throws[AnalysisException] + def verifyAlterTableOrAlterView( --- End diff -- Will rename it. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/12324#discussion_r59654734 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala --- @@ -533,5 +538,23 @@ private object DDLUtils { def isDatasourceTable(table: CatalogTable): Boolean = { isDatasourceTable(table.properties) } + + // If the command ALTER VIEW is to alter a table or ALTER TABLE is to alter a view, + // issue an exception. + @throws[AnalysisException] --- End diff -- Sure, will do it. Thanks! --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user andrewor14 commented on the pull request: https://github.com/apache/spark/pull/12324#issuecomment-209681785 Looks great! Only minor comments. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user andrewor14 commented on a diff in the pull request: https://github.com/apache/spark/pull/12324#discussion_r59639488 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala --- @@ -533,5 +538,23 @@ private object DDLUtils { def isDatasourceTable(table: CatalogTable): Boolean = { isDatasourceTable(table.properties) } + + // If the command ALTER VIEW is to alter a table or ALTER TABLE is to alter a view, + // issue an exception. + @throws[AnalysisException] --- End diff -- can you turn these into a java doc? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user andrewor14 commented on a diff in the pull request: https://github.com/apache/spark/pull/12324#discussion_r59639424 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala --- @@ -533,5 +538,23 @@ private object DDLUtils { def isDatasourceTable(table: CatalogTable): Boolean = { isDatasourceTable(table.properties) } + + // If the command ALTER VIEW is to alter a table or ALTER TABLE is to alter a view, + // issue an exception. + @throws[AnalysisException] + def verifyAlterTableOrAlterView( --- End diff -- I would just call this `verifyAlterTableType` and make this private --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user andrewor14 commented on a diff in the pull request: https://github.com/apache/spark/pull/12324#discussion_r59637909 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala --- @@ -232,16 +232,17 @@ case class DropTable( */ case class AlterTableRename( oldName: TableIdentifier, -newName: TableIdentifier) +newName: TableIdentifier, +isView: Boolean) extends RunnableCommand { override def run(sqlContext: SQLContext): Seq[Row] = { val catalog = sqlContext.sessionState.catalog +DDLUtils.verifyAlterTableOrAlterView(catalog, oldName, isView) catalog.invalidateTable(oldName) catalog.renameTable(oldName, newName) Seq.empty[Row] } - --- End diff -- nit: I left this line intentionally --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user gatorsmile commented on the pull request: https://github.com/apache/spark/pull/12324#issuecomment-209215575 cc @yhuai @andrewor14 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user AmplabJenkins commented on the pull request: https://github.com/apache/spark/pull/12324#issuecomment-208788653 Test PASSed. Refer to this link for build results (access rights to CI server needed): https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/55595/ Test PASSed. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user AmplabJenkins commented on the pull request: https://github.com/apache/spark/pull/12324#issuecomment-208788643 Merged build finished. Test PASSed. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user SparkQA commented on the pull request: https://github.com/apache/spark/pull/12324#issuecomment-208787493 **[Test build #55595 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/55595/consoleFull)** for PR 12324 at commit [`cd20636`](https://github.com/apache/spark/commit/cd20636f09eeb9ecd814a72b9c457d4f07a3142f). * This patch passes all tests. * This patch merges cleanly. * This patch adds no public classes. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
Github user SparkQA commented on the pull request: https://github.com/apache/spark/pull/12324#issuecomment-208746010 **[Test build #55595 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/55595/consoleFull)** for PR 12324 at commit [`cd20636`](https://github.com/apache/spark/commit/cd20636f09eeb9ecd814a72b9c457d4f07a3142f). --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-14125] [SQL] Native DDL Support: Alter ...
GitHub user gatorsmile opened a pull request: https://github.com/apache/spark/pull/12324 [SPARK-14125] [SQL] Native DDL Support: Alter View What changes were proposed in this pull request? This PR is to provide a native DDL support for the following three Alter View commands: Based on the Hive DDL document: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL # 1. ALTER VIEW RENAME **Syntax:** ```SQL ALTER VIEW view_name RENAME TO new_view_name ``` - to change the name of a view to a different name - not allowed to rename a view's name by ALTER TABLE # 2. ALTER VIEW SET TBLPROPERTIES **Syntax:** ```SQL ALTER VIEW view_name SET TBLPROPERTIES ('comment' = new_comment); ``` - to add metadata to a view - not allowed to set views' properties by ALTER TABLE - ignore it if trying to set a view's existing property key when the value is the same - overwrite the value if trying to set a view's existing key to a different value # 3. ALTER VIEW UNSET TBLPROPERTIES **Syntax:** ```SQL ALTER VIEW view_name UNSET TBLPROPERTIES [IF EXISTS] ('comment', 'key') ``` - to remove metadata from a view - not allowed to unset views' properties by ALTER TABLE - issue an exception if trying to unset a view's non-existent key How was this patch tested? Added test cases to verify if it works properly. You can merge this pull request into a Git repository by running: $ git pull https://github.com/gatorsmile/spark alterView Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/12324.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #12324 commit 34e44dac2c9f731fd69081ac0846800e3198de70 Author: gatorsmile Date: 2016-04-07T21:11:04Z fix 1 commit c040e1d4599f19a8354cc064b186dbbf66845e87 Author: gatorsmile Date: 2016-04-10T06:24:56Z Merge remote-tracking branch 'upstream/master' into alterView commit c8811bca6ebda2b29d7efdd66bdc384e9c7b32ea Author: gatorsmile Date: 2016-04-10T06:45:01Z correct compilation errors commit 66cb2c12d667e4d63c2112cd091100ecafe9ff0f Author: gatorsmile Date: 2016-04-12T03:26:37Z Merge remote-tracking branch 'upstream/master' into alterView commit c55ab123f016d166a4b4af98c5424967bac685b9 Author: gatorsmile Date: 2016-04-12T04:20:50Z impl commit ed5a7d0bf4dc4d0f997fe27a274e2d9cfa1749cc Author: gatorsmile Date: 2016-04-12T06:52:10Z added more test cases. commit cd20636f09eeb9ecd814a72b9c457d4f07a3142f Author: gatorsmile Date: 2016-04-12T06:58:18Z Merge remote-tracking branch 'upstream/master' into alterView --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org