Skip to content
Snippets Groups Projects
Commit 490ecfa2 authored by Ahir Reddy's avatar Ahir Reddy Committed by Michael Armbrust
Browse files

[SPARK-2844][SQL] Correctly set JVM HiveContext if it is passed into Python HiveContext constructor

https://issues.apache.org/jira/browse/SPARK-2844

Author: Ahir Reddy <ahirreddy@gmail.com>

Closes #1768 from ahirreddy/python-hive-context-fix and squashes the following commits:

7972d3b [Ahir Reddy] Correctly set JVM HiveContext if it is passed into Python HiveContext constructor
parent 6fab941b
No related branches found
No related tags found
No related merge requests found
......@@ -912,6 +912,8 @@ class SQLContext:
"""Create a new SQLContext.
@param sparkContext: The SparkContext to wrap.
@param sqlContext: An optional JVM Scala SQLContext. If set, we do not instatiate a new
SQLContext in the JVM, instead we make all calls to this object.
>>> srdd = sqlCtx.inferSchema(rdd)
>>> sqlCtx.inferSchema(srdd) # doctest: +IGNORE_EXCEPTION_DETAIL
......@@ -1315,6 +1317,18 @@ class HiveContext(SQLContext):
It supports running both SQL and HiveQL commands.
"""
def __init__(self, sparkContext, hiveContext=None):
"""Create a new HiveContext.
@param sparkContext: The SparkContext to wrap.
@param hiveContext: An optional JVM Scala HiveContext. If set, we do not instatiate a new
HiveContext in the JVM, instead we make all calls to this object.
"""
SQLContext.__init__(self, sparkContext)
if hiveContext:
self._scala_HiveContext = hiveContext
@property
def _ssql_ctx(self):
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment