[英]How can i show hive table using pyspark
Hello i created a spark HD insight cluster on azure and i'm trying to read hive tables with pyspark but the proble that its show me only default database你好,我在 azure 上创建了一个 spark HD insight 集群,我正在尝试使用 pyspark 读取 hive 表,但问题是它只显示默认数据库
Anyone have an idea?有人有想法吗?
If you are using HDInsight 4.0, Spark and Hive not share metadata anymore.如果您使用的是 HDInsight 4.0,Spark 和 Hive 将不再共享元数据。
For default you will not see hive tables from pyspark, is a problem that i share on this post: How save/update table in hive, to be readbale on spark .默认情况下,您不会看到 pyspark 中的 hive 表,这是我在这篇文章中分享的一个问题: How save/update table in hive, to be readbale on spark 。
But, anyway, things you can try:但是,无论如何,您可以尝试的事情:
These changes define hive metastore catalog as default.这些更改将 hive 元存储目录定义为默认值。 You can see hive databases and table now, but depending of table structure, you will not see the table data properly.
您现在可以看到 hive 个数据库和表,但是根据表结构,您将无法正常看到表数据。
If you have created tables in other databases, try show tables from database_name
.如果您在其他数据库中创建了表,请尝试
show tables from database_name
。 Replace database_name
with the actual name.将
database_name
替换为实际名称。
You are missing details of hive server in SparkSession.您在 SparkSession 中缺少 hive 服务器的详细信息。 If you haven't added any it will create and use default database to run sparksql.
如果您没有添加任何内容,它将创建并使用默认数据库来运行 sparksql。
If you've added configuration details in spark default conf file for spark.sql.warehouse.dir and spark.hadoop.hive.metastore.uris then while creating SparkSession add enableHiveSupport().如果您已在spark.sql.warehouse.dir 和 spark.hadoop.hive.metastore.uris的 spark 默认配置文件中添加了配置详细信息,则在创建 SparkSession 时添加 enableHiveSupport()。
Else add configuration details while creating sparksession否则在创建 sparksession 时添加配置详细信息
.config("spark.sql.warehouse.dir","/user/hive/warehouse")
.config("hive.metastore.uris","thrift://localhost:9083")
.enableHiveSupport()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.