[ 
https://issues.apache.org/jira/browse/SPARK-29260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17545264#comment-17545264
 ] 

Yuming Wang commented on SPARK-29260:
-------------------------------------

The syntax supports it, but it doesn't change location:
{code:scala}
sql("CREATE DATABASE db1")
sql("ALTER DATABASE db1 SET LOCATION 'file://tmp/spark/db1'")
sql("DESC DATABASE EXTENDED db1").show(false)
{code}
{noformat}
+--------------+-------------------------------------------------------------------------------------------------------------------+
|info_name     |info_value                                                      
                                                   |
+--------------+-------------------------------------------------------------------------------------------------------------------+
|Namespace Name|db1                                                             
                                                   |
|Comment       |                                                                
                                                   |
|Location      
|file:/private/var/folders/tg/f5mz46090wg7swzgdc69f8q03965_0/T/warehouse-cbe89b9b-528d-420f-bea5-5f7eb714dc07/db1.db|
|Owner         |yumwang                                                         
                                                   |
|Properties    |                                                                
                                                   |
+--------------+-------------------------------------------------------------------------------------------------------------------+
{noformat}

Hive 3.1 support it:
{noformat}
bin/spark-sql --conf spark.sql.hive.metastore.version=3.1.0 --conf 
spark.sql.hive.metastore.jars=maven

spark-sql> CREATE DATABASE db1;
Time taken: 2.628 seconds
spark-sql> ALTER DATABASE db1 SET LOCATION 'file://tmp/spark/db1';
Time taken: 0.142 seconds
spark-sql> DESC DATABASE EXTENDED db1;
Namespace Name  db1
Comment
Location        file:/spark/db1
Owner   yumwang
Properties
Time taken: 0.427 seconds, Fetched 5 row(s)
{noformat}




> Enable supported Hive metastore versions once it support altering database 
> location
> -----------------------------------------------------------------------------------
>
>                 Key: SPARK-29260
>                 URL: https://issues.apache.org/jira/browse/SPARK-29260
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 3.1.0
>            Reporter: Yuming Wang
>            Priority: Major
>
> Hive 3.x is supported currently. Hive 2.2.1 and Hive 2.4.0 have not released.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

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

Reply via email to