Skip to content

Commit 37ceb56

Browse files
committed
inferring from RDD of dict is OK, too
1 parent 4e5c365 commit 37ceb56

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

python/pyspark/sql/session.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,19 +374,16 @@ def _inferSchemaFromList(self, data, names=None):
374374

375375
def _inferSchema(self, rdd, samplingRatio=None, names=None):
376376
"""
377-
Infer schema from an RDD of Row or tuple.
377+
Infer schema from an RDD of Row, dict, or tuple.
378378
379-
:param rdd: an RDD of Row or tuple
379+
:param rdd: an RDD of Row, dict, or tuple
380380
:param samplingRatio: sampling ratio, or no sampling (default)
381381
:return: :class:`pyspark.sql.types.StructType`
382382
"""
383383
first = rdd.first()
384384
if not first:
385385
raise ValueError("The first row in RDD is empty, "
386386
"can not infer schema")
387-
if type(first) is dict:
388-
warnings.warn("Using RDD of dict to inferSchema is deprecated. "
389-
"Use pyspark.sql.Row instead")
390387

391388
if samplingRatio is None:
392389
schema = _infer_schema(first, names=names)

0 commit comments

Comments
 (0)