yaooqinn commented on a change in pull request #27933: [SPARK-31170][SQL] Spark
SQL Cli should respect hive-site.xml and spark.sql.warehouse.dir
URL: https://github.com/apache/spark/pull/27933#discussion_r393524009
##########
File path:
sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/CliSuite.scala
##########
@@ -159,6 +160,17 @@ class CliSuite extends SparkFunSuite with
BeforeAndAfterAll with Logging {
}
}
+ test("Pick spark.sql.warehouse.dir first for Spark Cli if set") {
+ val sparkWareHouseDir = Utils.createTempDir()
+ new File(warehousePath, "metastore_db").delete()
+ runCliWithin(
+ 1.minute,
+ Seq("--conf",
s"""${StaticSQLConf.WAREHOUSE_PATH.key}=$sparkWareHouseDir"""))(
+ """desc database default;""" -> sparkWareHouseDir.getAbsolutePath
+ )
+ sparkWareHouseDir.delete()
Review comment:
I also checked manually
#### now
```sql
kentyao@hulk ~/Downloads/spark/spark-3.1.0-SNAPSHOT-bin-v20200317
bin/spark-sql -S --conf
spark.sql.warehouse.dir=/Users/kentyao/Downloads/spark/spark-3.1.0-SNAPSHOT-bin-v20200317/data/spark-warehouse
spark-sql> desc database default;
Database Name default
Comment Default Hive database
Location
file:/Users/kentyao/Downloads/spark/spark-3.1.0-SNAPSHOT-bin-v20200317/data/spark-warehouse
Owner public
```
#### 3.x and 2.4
```sql
kentyao@hulk ~/Downloads/spark/spark-2.4.5-bin-hadoop2.7 bin/spark-sql
-S -c
spark.sql.warehouse.dir=/Users/kentyao/Downloads/spark/spark-3.1.0-SNAPSHOT-bin-v20200317/data/spark-warehouse
spark-sql> desc database default;
Database Name default
Description Default Hive database
Location file:/user/hive/warehouse
```
----------------------------------------------------------------
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]