Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pystellardb/stellar_hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def _convertData(self, type, data):
elif type == 'int':
return int(data)
elif type == 'long':
return long(data)
return int(data)
elif type == 'float' or type == 'double':
return float(data)
elif type == 'CruxType:Node' or type == 'GraphNode':
Expand Down
12 changes: 10 additions & 2 deletions pystellardb/stellar_rdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
import abc
from future.utils import with_metaclass
import logging
from pyspark import RDD, SparkContext
from pyspark.serializers import BatchedSerializer

try:
import pyspark
from pyspark import RDD, SparkContext
from pyspark.serializers import BatchedSerializer
except ImportError:
pyspark = None

_logger = logging.getLogger(__name__)

Expand All @@ -20,6 +25,9 @@ def transformToRDD(cursor, sc, parallelism=1):
param sc: SparkContext
param parallelism: Parallelism of RDD
"""
if not pyspark:
raise ImportError("Could not import pyspark! Please run `pip install pyspark` first in your environment!")

# Get all data from cursor
data = cursor.fetchall()

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@
'pyhive',
'sasl',
'thrift',
'thrift-sasl>=0.3.0',
'pyspark>=2.4.0'
'thrift-sasl>=0.3.0'
],
extras_require={
'presto': ['requests>=1.0.0'],
'hive': ['sasl>=0.2.1', 'thrift>=0.10.0'],
'sqlalchemy': ['sqlalchemy>=1.3.0'],
'kerberos': ['requests_kerberos>=0.12.0'],
'pyspark': ['pyspark>=2.4.0']
},
tests_require=[
'mock>=1.0.0',
Expand Down