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 2020/10/08 07:26:48 UTC

[GitHub] [spark] zero323 commented on a change in pull request #29947: [SPARK-32793][SQL] Add raise_error function, adds error message parameter to assert_true

zero323 commented on a change in pull request #29947:
URL: https://github.com/apache/spark/pull/29947#discussion_r501502832



##########
File path: python/pyspark/sql/functions.pyi
##########
@@ -137,6 +137,8 @@ def sha1(col: ColumnOrName) -> Column: ...
 def sha2(col: ColumnOrName, numBits: int) -> Column: ...
 def hash(*cols: ColumnOrName) -> Column: ...
 def xxhash64(*cols: ColumnOrName) -> Column: ...
+def assert_true(col: ColumnOrName, errMsg: Union[Column, str] = ...): ...

Review comment:
       Two small notes (sorry for being late):
   
   - I think we should annotate return type for `assert_true` - it will type check because of implicit `Any`, but I think it is better to avoid such cases
   
      ```python
      def assert_true(col: ColumnOrName, errMsg: Union[Column, str] = ...) -> Column: ...
      ```
   
   - For `def raise_error` I'd use [`NoReturn`](https://docs.python.org/3/library/typing.html#typing.NoReturn):
   
       ```python
       from typing import NoReturn
   
       def raise_error(errMsg: Union[Column, str]) -> NoReturn: ...
       ```




----------------------------------------------------------------
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.

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