Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15004#discussion_r77941648
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala 
---
    @@ -318,44 +331,51 @@ class HiveDDLSuite
             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"))
    +        checkMisuseForAlterTableOrView(
    +          s"$tabName RENAME TO $newViewName", isAlterView = true)
     
    -        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"))
    +        checkMisuseForAlterTableOrView(
    +          s"$oldViewName RENAME TO $newViewName", isAlterView = false)
     
    -        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"))
    +        checkMisuseForAlterTableOrView(
    +          s"$tabName SET TBLPROPERTIES ('p' = 'an')", isAlterView = true)
     
    -        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"))
    +        checkMisuseForAlterTableOrView(
    +          s"$oldViewName SET TBLPROPERTIES ('p' = 'an')", isAlterView = 
false)
     
    -        message = intercept[AnalysisException] {
    -          sql(s"ALTER TABLE $oldViewName SET TBLPROPERTIES ('p' = 'an')")
    -        }.getMessage
    -        assert(message.contains(
    -          "Cannot alter a view with ALTER TABLE. Please use ALTER VIEW 
instead"))
    +        checkMisuseForAlterTableOrView(
    +          s"$tabName UNSET TBLPROPERTIES ('p')", isAlterView = true)
     
    -        message = intercept[AnalysisException] {
    -          sql(s"ALTER TABLE $oldViewName UNSET TBLPROPERTIES ('p')")
    -        }.getMessage
    -        assert(message.contains(
    -          "Cannot alter a view with ALTER TABLE. Please use ALTER VIEW 
instead"))
    +        checkMisuseForAlterTableOrView(
    +          s"$oldViewName UNSET TBLPROPERTIES ('p')", isAlterView = false)
    +
    +        checkMisuseForAlterTableOrView(
    +          s"$oldViewName SET LOCATION '/path/to/your/lovely/heart'", 
isAlterView = false)
    +
    +        checkMisuseForAlterTableOrView(
    +          s"$oldViewName SET SERDE 'whatever'", isAlterView = false)
    +
    +        checkMisuseForAlterTableOrView(
    +          s"$oldViewName SET SERDEPROPERTIES ('x' = 'y')", isAlterView = 
false)
    +
    +        checkMisuseForAlterTableOrView(
    +          s"$oldViewName PARTITION (a=1, b=2) SET SERDEPROPERTIES ('x' = 
'y')", isAlterView = false)
    +
    +        checkMisuseForAlterTableOrView(
    +          s"$oldViewName ADD IF NOT EXISTS PARTITION (a='4', b='8')", 
isAlterView = false)
    +
    --- End diff --
    
    We also need to test `isAlterView` = `true` for `ADD PARTITION` and `DROP 
PARTITION`. Let me add them now...


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to