Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/11347#discussion_r54208704
--- Diff: python/pyspark/sql/context.py ---
@@ -48,28 +48,29 @@
def _monkey_patch_RDD(sqlContext):
- def toDF(self, schema=None, sampleRatio=None):
+ def toDS(self, schema=None, sampleRatio=None):
"""
- Converts current :class:`RDD` into a :class:`DataFrame`
+ Converts current :class:`RDD` into a :class:`Dataset`
- This is a shorthand for ``sqlContext.createDataFrame(rdd, schema,
sampleRatio)``
+ This is a shorthand for ``sqlContext.createDataset(rdd, schema,
sampleRatio)``
:param schema: a StructType or list of names of columns
:param samplingRatio: the sample ratio of rows used for inferring
- :return: a DataFrame
+ :return: a Dataset
- >>> rdd.toDF().collect()
+ >>> rdd.toDS().collect()
[Row(name=u'Alice', age=1)]
"""
- return sqlContext.createDataFrame(self, schema, sampleRatio)
+ return sqlContext.createDataset(self, schema, sampleRatio)
- RDD.toDF = toDF
+ RDD.toDS = toDS
+ RDD.toDF = toDS # for compatibility
--- End diff --
is there a test for backward compatibility?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]