在SparkSQL中缓存表中的错误 [英] Error in Caching a Table in SparkSQL

查看:535
本文介绍了在SparkSQL中缓存表中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Hive中缓存一个Table(使用 spark-shell )。以下是我的代码

I am trying to cache a Table available in Hive(using spark-shell). Given below is my code

scala> val hiveContext = new org.apache.spark.sql.hive.HiveContext(sc)

scala> hiveContext.cacheTable("sparkdb.firsttable")

我得到下面的异常

org.apache.spark.sql.catalyst.analysis.NoSuchTableException
    at org.apache.spark.sql.hive.client.ClientInterface$$anonfun$getTable$1.apply(ClientInterface.scala:112)

firsttable 可用于数据库 sparkdb (在Hive中)。看起来问题似乎是提供数据库名称。如何实现这一点?

The table firsttable is available in database sparkdb(in Hive). Looks like the issue seems to be in providing database name. How do I achieve this?

PS:像下面显示的那样的HiveQL查询没有任何问题的工作

PS : HiveQL query like the one shown below does work without any issues

阶> hiveContext.sql(select * from sparkdb.firsttable)

从其他几个方法调用中找到下面的结果

Find below results from few other method calls

scala> hiveContext.tables("sparkdb")
res14: org.apache.spark.sql.DataFrame = [tableName: string, isTemporary: boolean]

scala> hiveContext.tables("sparkdb.firsttable")
res15: org.apache.spark.sql.DataFrame = [tableName: string, isTemporary: boolean]


推荐答案

我是对的,这似乎是 SPARK-8105 。所以,现在,你最好的选择是做 select * 并缓存它。

Aha! I was right, this seems to be SPARK-8105. So, for now, your best bet is to do the select * and cache that.

这篇关于在SparkSQL中缓存表中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆