aboutsummaryrefslogtreecommitdiff
path: root/python/pyspark/sql/context.py
diff options
context:
space:
mode:
authorElisey Zanko <elisey.zanko@gmail.com>2015-04-20 10:44:09 -0700
committerJosh Rosen <joshrosen@databricks.com>2015-04-20 10:44:09 -0700
commit77176619a97d07811ab20e1dde4677359d85eb33 (patch)
tree3d362532bd4a21d2c888425791418e6001485d80 /python/pyspark/sql/context.py
parent968ad972175390bb0a96918fd3c7b318d70fa466 (diff)
downloadspark-77176619a97d07811ab20e1dde4677359d85eb33.tar.gz
spark-77176619a97d07811ab20e1dde4677359d85eb33.tar.bz2
spark-77176619a97d07811ab20e1dde4677359d85eb33.zip
[SPARK-6661] Python type errors should print type, not object
Author: Elisey Zanko <elisey.zanko@gmail.com> Closes #5361 from 31z4/spark-6661 and squashes the following commits: 73c5d79 [Elisey Zanko] Python type errors should print type, not object
Diffstat (limited to 'python/pyspark/sql/context.py')
-rw-r--r--python/pyspark/sql/context.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/python/pyspark/sql/context.py b/python/pyspark/sql/context.py
index c90afc326c..acf3c11454 100644
--- a/python/pyspark/sql/context.py
+++ b/python/pyspark/sql/context.py
@@ -208,7 +208,7 @@ class SQLContext(object):
raise TypeError("Cannot apply schema to DataFrame")
if not isinstance(schema, StructType):
- raise TypeError("schema should be StructType, but got %s" % schema)
+ raise TypeError("schema should be StructType, but got %s" % type(schema))
return self.createDataFrame(rdd, schema)
@@ -281,7 +281,7 @@ class SQLContext(object):
# data could be list, tuple, generator ...
rdd = self._sc.parallelize(data)
except Exception:
- raise ValueError("cannot create an RDD from type: %s" % type(data))
+ raise TypeError("cannot create an RDD from type: %s" % type(data))
else:
rdd = data
@@ -293,8 +293,8 @@ class SQLContext(object):
if isinstance(schema, (list, tuple)):
first = rdd.first()
if not isinstance(first, (list, tuple)):
- raise ValueError("each row in `rdd` should be list or tuple, "
- "but got %r" % type(first))
+ raise TypeError("each row in `rdd` should be list or tuple, "
+ "but got %r" % type(first))
row_cls = Row(*schema)
schema = self._inferSchema(rdd.map(lambda r: row_cls(*r)), samplingRatio)