Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Update distinct() and repartition() definitions (#138)
Browse files Browse the repository at this point in the history
* Update repartition functions to allow for Col in numPartitions parameter.

Reference: https://spark.apache.org/docs/latest/api/python/pyspark.sql.html#pyspark.sql.DataFrame.repartition

numPartitions – can be an int to specify the target number of partitions or a Column.
If it is a Column, it will be used as the first partitioning column.
If not specified, the default number of partitions is used.

* Add stub for DataFrame#distinct

* Break apart the Union into overloaded signatures

* Update repartitionByRange by splitting the Union into overloaded signatures
  • Loading branch information
zpencerq authored and zero323 committed Jun 30, 2019
1 parent d342ecf commit 623b0c0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions third_party/3/pyspark/sql/dataframe.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,15 @@ class DataFrame:
def storageLevel(self) -> StorageLevel: ...
def unpersist(self, blocking: bool = ...) -> DataFrame: ...
def coalesce(self, numPartitions: int) -> DataFrame: ...
@overload
def repartition(self, numPartitions: int, *cols: ColumnOrName) -> DataFrame: ...
@overload
def repartition(self, *cols: ColumnOrName) -> DataFrame: ...
@overload
def repartitionByRange(self, numPartitions: int, *cols: ColumnOrName) -> DataFrame: ...
@overload
def repartitionByRange(self, *cols: ColumnOrName) -> DataFrame: ...
def distinct(self) -> DataFrame: ...
def sample(self, withReplacement: Optional[bool], fraction: float, seed: Optional[int] = ...) -> DataFrame: ...
def sampleBy(self, col: str, fractions: float, seed: Optional[int] = ...) -> DataFrame: ...
def randomSplit(self, weights: List[float], seed: Optional[int] = ...) -> List[DataFrame]: ...
Expand Down

0 comments on commit 623b0c0

Please sign in to comment.