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

    https://github.com/apache/spark/pull/13831#discussion_r70065994
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/client/VersionsSuite.scala ---
    @@ -249,7 +249,18 @@ class VersionsSuite extends SparkFunSuite with Logging 
{
         }
     
         test(s"$version: dropTable") {
    -      client.dropTable("default", tableName = "temporary", 
ignoreIfNotExists = false)
    +      // First try with the purge option set. This should fail if the 
version is < 0.14, in which
    +      // case we check the version and try without it.
    +      try {
    +        client.dropTable("default", tableName = "temporary", 
ignoreIfNotExists = false,
    +          purge = true)
    +      } catch {
    +        case _: UnsupportedOperationException =>
    +          val oldVersions = versions.takeWhile(_ != "0.14")
    +          assert(oldVersions.contains(version))
    +          client.dropTable("default", tableName = "temporary", 
ignoreIfNotExists = false,
    +            purge = false)
    +      }
    --- End diff --
    
    this doesn't make sure the old versions actually throw an 
UnsupportedOperationException (eg., could just silently ignore purge).  change 
it to:
    
    ```scala
    var exception: UnsupportedOperationException = null
    try {
      client.dropTable("default", tableName = "temporary", ignoreIfNotExists = 
false,
        purge = true)
     } catch {
       case ex: UnsupportedOperationException =>  exception = ex
    }
    if (oldVersions.contains(version)) {
      assert(exception != null)
      client.dropTable("default", tableName = "temporary", ignoreIfNotExists = 
false,
        purge = false)
    } else {
      assert(exception == null)
    }
    ```


---
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