How do you set a hive property like: hive.metastore.warehouse.dir
at runtime? Or at least a more dynamic way of setting a property like the above, than putting it in a file like spark_home/conf/hive-site.xml
相关问题
- How to maintain order of key-value in DataFrame sa
- Spark on Yarn Container Failure
- In Spark Streaming how to process old data and del
- Filter from Cassandra table by RDD values
- Spark 2.1 cannot write Vector field on CSV
相关文章
- 在hive sql里怎么把"2020-10-26T08:41:19.000Z"这个字符串转换成年月日
- Livy Server: return a dataframe as JSON?
- SQL query Frequency Distribution matrix for produc
- Cloudera 5.6: Parquet does not support date. See H
- How to filter rows for a specific aggregate with s
- How to name file when saveAsTextFile in spark?
- Spark save(write) parquet only one file
- Could you give me any clue Why 'Cannot call me
I faced the same issue and for me it worked by setting Hive properties from Spark (2.4.0). Please find below all the options through spark-shell, spark-submit and SparkConf.
Option 1 (spark-shell)
Initially I tried with spark-shell with
hive.metastore.warehouse.dir
set tosome_path\metastore_db_2
. Then I get the next warning:Although when I create a Hive table with:
The Hive metadata are stored correctly under metastore_db_2 folder.
When I use
spark.hadoop.hive.metastore.warehouse.dir
the warning disappears and the results are still saved in the metastore_db_2 directory.Option 2 (spark-submit)
In order to use
hive.metastore.warehouse.dir
when submitting a job with spark-submit I followed the next steps.First I wrote some code to save some random data with Hive:
Next I submitted the job with:
The metastore_test table was properly created under the
C:\winutils\hadoop-2.7.1\bin\metastore_db_2
folder.Option 3 (SparkConf)
Via SparkSession in the Spark code.
This attempt was successful as well.
The question which still remains is why I have to extend the property with
spark.hadoop
in order to work as expected?