在 spark 中使用 Hive 上下文时出错:对象 hive 不是包 org.apache.spark.sql 的成员 [英] Error while using Hive context in spark : object hive is not a member of package org.apache.spark.sql

查看:42
本文介绍了在 spark 中使用 Hive 上下文时出错:对象 hive 不是包 org.apache.spark.sql 的成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个继承自 SQLContext 的 Hive Context.

I am trying to construct a Hive Context ,which inherits from SQLContext.

val sqlContext = new org.apache.spark.sql.hive.HiveContext(sc)

我收到以下错误:

error: object hive is not a member of package org.apache.spark.sql
       val sqlContext = new org.apache.spark.sql.hive.HiveContext(sc)

我可以从自动完成中清楚地看到 hive 不存在.关于如何解决这个问题的任何想法?这是来自可用 sparkSQL 文档的示例.

I can clearly see from the autocompletion that hive doest not exist. Any ideas on how to resolve this? This is an example fromthe sparkSQL documentation available.

谢谢

推荐答案

由于 hive 的依赖关系,默认情况下它不会编译到 spark 二进制文件中,您必须自己构建它.引用自 网站

Because of hive's dependencies it is not compiled into the spark binary by default you have to build it yourself. Quote from the website

但是,由于 Hive 有大量的依赖项,因此它不包含在默认的 Spark 程序集中.为了使用 Hive,您必须首先运行 sbt/sbt -Phive assembly/assembly(或使用 -Phive for maven).

However, since Hive has a large number of dependencies, it is not included in the default Spark assembly. In order to use Hive you must first run sbt/sbt -Phive assembly/assembly (or use -Phive for maven).

这篇关于在 spark 中使用 Hive 上下文时出错:对象 hive 不是包 org.apache.spark.sql 的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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