user8270077
user8270077

Reputation: 5071

ImportError: cannot import name 'HiveContext' from 'pyspark.sql'

I am running pyspark in my PC (windows 10) but I can not import HiveContext:

from pyspark.sql import HiveContext
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-25-e3ae767de910> in <module>
----> 1 from pyspark.sql import HiveContext

ImportError: cannot import name 'HiveContext' from 'pyspark.sql' (C:\spark\spark-3.0.0-preview-bin-hadoop2.7\python\pyspark\sql\__init__.py)

How I should proceed to resolve it?

Upvotes: 0

Views: 1724

Answers (1)

Oliver W.
Oliver W.

Reputation: 13459

You’re using the preview release of Spark 3.0. According to the release notes, you should use SparkSession.builder.enableHiveSupport().

In Spark 3.0, the deprecated HiveContext class has been removed. Use SparkSession.builder.enableHiveSupport() instead.

Upvotes: 2

Related Questions