dongjoon-hyun commented on code in PR #36750:
URL: https://github.com/apache/spark/pull/36750#discussion_r888477684
##########
sql/hive/src/test/scala/org/apache/spark/sql/hive/client/HiveClientSuite.scala:
##########
@@ -165,19 +165,19 @@ class HiveClientSuite(version: String, allVersions:
Seq[String])
assert(client.getDatabase("temporary").properties.contains("flag"))
// test alter database location
+ val oldDatabasePath = database.locationUri.getPath
val tempDatabasePath2 = Utils.createTempDir().toURI
- // Hive support altering database location since HIVE-8472.
+ client.alterDatabase(database.copy(locationUri = tempDatabasePath2))
+ val uriInCatalog = client.getDatabase("temporary").locationUri
+ assert("file" === uriInCatalog.getScheme)
+
if (version == "3.0" || version == "3.1") {
- client.alterDatabase(database.copy(locationUri = tempDatabasePath2))
- val uriInCatalog = client.getDatabase("temporary").locationUri
- assert("file" === uriInCatalog.getScheme)
+ // Hive support altering database location since HIVE-8472
assert(new Path(tempDatabasePath2.getPath).toUri.getPath ===
uriInCatalog.getPath,
"Failed to alter database location")
} else {
- val e = intercept[AnalysisException] {
- client.alterDatabase(database.copy(locationUri = tempDatabasePath2))
- }
- assert(e.getMessage.contains("does not support altering database
location"))
+ // .. otherwise, the command should be non-effective against older
versions of Hive
+ assert(oldDatabasePath === uriInCatalog.getPath, "Expected database
location to be unchanged")
Review Comment:
Sorry for misleading you, @sunchao . I was wondering this case which didn't
throw exception. If there is no sign of failures (or no-op), the customer will
surprise at the next session.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]