wangyum commented on a change in pull request #25883: [SPARK-28476][SQL]
Support ALTER DATABASE SET LOCATION
URL: https://github.com/apache/spark/pull/25883#discussion_r326938596
##########
File path:
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala
##########
@@ -363,6 +363,12 @@ private[hive] class HiveClientImpl(
}
override def alterDatabase(database: CatalogDatabase): Unit = withHiveState {
+ if (!getDatabase(database.name).locationUri.equals(database.locationUri)) {
+ if (!(version.equals(hive.v3_0) || version.equals(hive.v3_1))) {
Review comment:
Hive 3.0:
```
hive> select version();
OK
3.0.0 rce61711a5fa54ab34fc74d86d521ecaeea6b072a
Time taken: 2.505 seconds, Fetched: 1 row(s)
hive> create database db1;
OK
Time taken: 0.051 seconds
hive> desc database db1;
OK
db1 file:/user/hive/warehouse/db1.db root USER
Time taken: 0.019 seconds, Fetched: 1 row(s)
hive> ALTER DATABASE db1 SET LOCATION 'file:/tmp/default';
OK
Time taken: 0.043 seconds
hive> desc database db1;
OK
db1 file:/tmp/default root USER
Time taken: 0.01 seconds, Fetched: 1 row(s)
```
Hive 3.1:
```
hive> select version();
OK
3.1.1 rf4e0529634b6231a0072295da48af466cf2f10b7
Time taken: 0.096 seconds, Fetched: 1 row(s)
hive> create database db1;
OK
Time taken: 0.014 seconds
hive> desc database db1;
OK
db1 file:/user/hive/warehouse/db1.db root USER
Time taken: 0.01 seconds, Fetched: 1 row(s)
hive> ALTER DATABASE db1 SET LOCATION 'file:/tmp/default';
OK
Time taken: 0.016 seconds
hive> desc database db1;
OK
db1 file:/tmp/default root USER
Time taken: 0.011 seconds, Fetched: 1 row(s)
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]