You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2021/07/04 01:23:49 UTC
[spark] branch master updated: [SPARK-35986][PYSPARK] Fix type hint
for RDD.histogram's buckets
This is an automated email from the ASF dual-hosted git repository.
gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 495d234 [SPARK-35986][PYSPARK] Fix type hint for RDD.histogram's buckets
495d234 is described below
commit 495d234c6e06c8e1d1e551805afefb104027ac9f
Author: Tomas Pereira de Vasconcelos <to...@gmail.com>
AuthorDate: Sun Jul 4 10:22:57 2021 +0900
[SPARK-35986][PYSPARK] Fix type hint for RDD.histogram's buckets
### What changes were proposed in this pull request?
Fix the type hint for `pyspark.rdd .RDD.histogram`'s `buckets` argument
### Why are the changes needed?
The current type hint is incomplete.
![image](https://user-images.githubusercontent.com/17701527/124248180-df7fd580-db22-11eb-8391-ba0bb51d689b.png)
From `pyspark.rdd .RDD.histogram`'s source:
```python
if isinstance(buckets, int):
...
elif isinstance(buckets, (list, tuple)):
...
else:
raise TypeError("buckets should be a list or tuple or number(int or long)")
```
### Does this PR introduce _any_ user-facing change?
Fixed the warning displayed above.
### How was this patch tested?
Fixed warning above with this change.
Closes #33185 from tpvasconcelos/master.
Authored-by: Tomas Pereira de Vasconcelos <to...@gmail.com>
Signed-off-by: Hyukjin Kwon <gu...@apache.org>
---
python/pyspark/rdd.pyi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/python/pyspark/rdd.pyi b/python/pyspark/rdd.pyi
index a277cd9..317a0db 100644
--- a/python/pyspark/rdd.pyi
+++ b/python/pyspark/rdd.pyi
@@ -245,7 +245,7 @@ class RDD(Generic[T]):
def sum(self: RDD[NumberOrArray]) -> NumberOrArray: ...
def count(self) -> int: ...
def stats(self: RDD[NumberOrArray]) -> StatCounter: ...
- def histogram(self, buckets: List[T]) -> Tuple[List[T], List[int]]: ...
+ def histogram(self, buckets: Union[int, List[T], Tuple[T, ...]]) -> Tuple[List[T], List[int]]: ...
def mean(self: RDD[NumberOrArray]) -> NumberOrArray: ...
def variance(self: RDD[NumberOrArray]) -> NumberOrArray: ...
def stdev(self: RDD[NumberOrArray]) -> NumberOrArray: ...
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org