Skip to content

Commit

Permalink
[SPARK-35226][SQL][FOLLOWUP] Fix test added in SPARK-35226 for DB2Krb…
Browse files Browse the repository at this point in the history
…IntegrationSuite

### What changes were proposed in this pull request?

This PR fixes an test added in SPARK-35226 (#32344).

### Why are the changes needed?

`SELECT 1` seems non-valid query for DB2.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

DB2KrbIntegrationSuite passes on my laptop.

I also confirmed all the KrbIntegrationSuites pass with the following command.
```
build/sbt -Phive -Phive-thriftserver -Pdocker-integration-tests "testOnly org.apache.spark.sql.jdbc.*KrbIntegrationSuite"
```

Closes #32632 from sarutak/followup-SPARK-35226.

Authored-by: Kousuke Saruta <sarutak@oss.nttdata.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
  • Loading branch information
sarutak authored and dongjoon-hyun committed May 23, 2021
1 parent a59a214 commit 1a43415
Showing 1 changed file with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,19 +178,7 @@ abstract class DockerKrbJDBCIntegrationSuite extends DockerJDBCIntegrationSuite
.option("keytab", keytabFullPath)
.option("principal", principal)
.option("refreshKrb5Config", "true")
.option("query", "SELECT 1")
.load()
}

// Set the authentic krb5.conf but doesn't refresh config
// so this assertion is expected to fail.
intercept[Exception] {
sys.props(KRB5_CONF_PROP) = origKrb5Conf
spark.read.format("jdbc")
.option("url", jdbcUrl)
.option("keytab", keytabFullPath)
.option("principal", principal)
.option("query", "SELECT 1")
.option("dbtable", "bar")
.load()
}

Expand All @@ -200,11 +188,11 @@ abstract class DockerKrbJDBCIntegrationSuite extends DockerJDBCIntegrationSuite
.option("keytab", keytabFullPath)
.option("principal", principal)
.option("refreshKrb5Config", "true")
.option("query", "SELECT 1")
.option("dbtable", "bar")
.load()
val result = df.collect().map(_.getInt(0))
val result = df.collect().map(_.getString(0))
assert(result.length === 1)
assert(result(0) === 1)
assert(result(0) === "hello")
} finally {
sys.props(KRB5_CONF_PROP) = origKrb5Conf
}
Expand Down

0 comments on commit 1a43415

Please sign in to comment.