We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 09b9980 commit 251f99dCopy full SHA for 251f99d
python/pyspark/context.py
@@ -475,9 +475,10 @@ def sql(self, sqlQuery):
475
return SchemaRDD(self._ssql_ctx.sql(sqlQuery), self)
476
477
def applySchema(self, rdd):
478
- first = rdd.first()
479
if (rdd.__class__ is SchemaRDD):
480
raise Exception("Cannot apply schema to %s" % SchemaRDD.__name__)
+ elif type(rdd.first()) is not dict:
481
+ raise Exception("Only RDDs with dictionaries can be converted to %s" % SchemaRDD.__name__)
482
483
jrdd = self._sc._pythonToJavaMap(rdd._jrdd)
484
srdd = self._ssql_ctx.applySchema(jrdd.rdd())
0 commit comments