You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/08/16 11:18:32 UTC

[GitHub] [spark] itholic commented on a diff in pull request #37367: [SPARK-39941][PYTHON][PS] window and min_periods should be integer in rolling func

itholic commented on code in PR #37367:
URL: https://github.com/apache/spark/pull/37367#discussion_r946645052


##########
python/pyspark/pandas/window.py:
##########
@@ -144,10 +144,15 @@ def __init__(
         window: int,
         min_periods: Optional[int] = None,
     ):
+        if type(window) is not int:

Review Comment:
   Can we use `isinstance` instead ?
   
   ```python
   if not isinstance(window, int):
      ...
   ```



##########
python/pyspark/pandas/window.py:
##########
@@ -144,10 +144,15 @@ def __init__(
         window: int,
         min_periods: Optional[int] = None,
     ):
+        if type(window) is not int:
+            raise ValueError("window must be an integer")

Review Comment:
   Can we follow the error message same as pandas ?
   
   ```python
   >>> ps.range(10).to_pandas().rolling(window=1.1)
   Traceback (most recent call last):
   ...
   ValueError: window must be an integer 0 or greater
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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