spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cloud-fan <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-13593][SQL] improve the `toDF()` method...
Date Fri, 04 Mar 2016 01:35:20 GMT
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11444#discussion_r54979311
  
    --- Diff: python/pyspark/sql/context.py ---
    @@ -50,18 +50,56 @@
     def _monkey_patch_RDD(sqlContext):
         def toDF(self, schema=None, sampleRatio=None):
             """
    -        Converts current :class:`RDD` into a :class:`DataFrame`
    +        Converts current :class:`RDD` into a :class:`DataFrame` according to the given
schema.
    +        If the given schema is None or just column names, the schema will be inferred
by scanning
    +        the data in this RDD according to the sampleRatio.
     
    -        This is a shorthand for ``sqlContext.createDataFrame(rdd, schema, sampleRatio)``
    +        Note that, the given schema must match the real data, or exception will be thrown
at
    +        runtime. If the given schema is not StructType, it will be wrapped into a StructType
as
    +        its only field, and the field name will be "value", each record will also be
wrapped into a
    +        tuple, which can be converted to row later.
     
    -        :param schema: a StructType or list of names of columns
    +        :param schema: a :class:`DataType` or a datatype string or list of names of columns
    --- End diff --
    
    or should I move it here?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message