当前位置: 首页>>代码示例>>Python>>正文


Python types._create_cls函数代码示例

本文整理汇总了Python中pyspark.sql.types._create_cls函数的典型用法代码示例。如果您正苦于以下问题:Python _create_cls函数的具体用法?Python _create_cls怎么用?Python _create_cls使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_create_cls函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: collect

    def collect(self):
        """Returns all the records as a list of :class:`Row`.

        >>> df.collect()
        [Row(age=2, name=u'Alice'), Row(age=5, name=u'Bob')]
        """
        with SCCallSiteSync(self._sc) as css:
            port = self._sc._jvm.PythonRDD.collectAndServe(self._jdf.javaToPython().rdd())
        rs = list(_load_from_socket(port, BatchedSerializer(PickleSerializer())))
        cls = _create_cls(self.schema)
        return [cls(r) for r in rs]
开发者ID:ZhangQingcheng,项目名称:spark,代码行数:11,代码来源:dataframe.py

示例2: collect

    def collect(self):
        """Return a list that contains all of the rows.

        Each object in the list is a Row, the fields can be accessed as
        attributes.

        >>> df.collect()
        [Row(age=2, name=u'Alice'), Row(age=5, name=u'Bob')]
        """
        with SCCallSiteSync(self._sc) as css:
            port = self._sc._jvm.PythonRDD.collectAndServe(self._jdf.javaToPython().rdd())
        rs = list(_load_from_socket(port, BatchedSerializer(PickleSerializer())))
        cls = _create_cls(self.schema)
        return [cls(r) for r in rs]
开发者ID:SkKamaruddin,项目名称:spark,代码行数:14,代码来源:dataframe.py

示例3: collect

    def collect(self):
        """Return a list that contains all of the rows.

        Each object in the list is a Row, the fields can be accessed as
        attributes.

        >>> df.collect()
        [Row(age=2, name=u'Alice'), Row(age=5, name=u'Bob')]
        """
        with SCCallSiteSync(self._sc) as css:
            bytesInJava = self._jdf.javaToPython().collect().iterator()
        tempFile = NamedTemporaryFile(delete=False, dir=self._sc._temp_dir)
        tempFile.close()
        self._sc._writeToFile(bytesInJava, tempFile.name)
        # Read the data into Python and deserialize it:
        with open(tempFile.name, 'rb') as tempFile:
            rs = list(BatchedSerializer(PickleSerializer()).load_stream(tempFile))
        os.unlink(tempFile.name)
        cls = _create_cls(self.schema)
        return [cls(r) for r in rs]
开发者ID:Sunyifan,项目名称:spark,代码行数:20,代码来源:dataframe.py

示例4: applySchema

 def applySchema(it):
     cls = _create_cls(schema)
     return map(cls, it)
开发者ID:ZhangQingcheng,项目名称:spark,代码行数:3,代码来源:dataframe.py

示例5: applySchema

 def applySchema(it):
     cls = _create_cls(schema)
     return itertools.imap(cls, it)
开发者ID:CharmLynn,项目名称:spark,代码行数:3,代码来源:dataframe.py


注:本文中的pyspark.sql.types._create_cls函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。