我如何使用 pyspark 显示配置单元表
你好,我在 azure 上创建了一个 Spark HD Insight 集群,我正在尝试使用 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
Anyone have an idea ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您在 SparkSession 中缺少配置单元服务器的详细信息。如果您没有添加任何内容,它将创建并使用默认数据库来运行sparksql。
如果您已在spark默认conf文件中添加了spark.sql.warehouse.dir和spark.hadoop.hive.metastore.uris的配置详细信息,则在创建SparkSession时添加enableHiveSupport()。
否则在创建 SparkSession 时添加配置详细信息
You are missing details of hive server in SparkSession. If you haven't added any it will create and use default database to run 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().
Else add configuration details while creating sparksession
如果您使用 HDInsight 4.0,Spark 和 Hive 不再共享元数据。
默认情况下,您不会看到来自 pyspark 的配置单元表,这是我在这篇文章中分享的一个问题:如何在 hive 中保存/更新表,以便在 Spark 上读取。
但是,无论如何,您可以尝试以下操作:
这些更改将 hive 元存储目录定义为默认值。
您现在可以看到 Hive 数据库和表,但根据表结构,您将无法正确看到表数据。
If you are using HDInsight 4.0, Spark and Hive not share metadata anymore.
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.
But, anyway, things you can try:
These changes define hive metastore catalog as default.
You can see hive databases and table now, but depending of table structure, you will not see the table data properly.
如果您已在其他数据库中创建了表,请尝试
显示database_name 中的表
。将database_name
替换为实际名称。If you have created tables in other databases, try
show tables from database_name
. Replacedatabase_name
with the actual name.