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/11/25 03:31:17 UTC

[GitHub] [spark] HyukjinKwon commented on a diff in pull request #38796: [SPARK-41260][PYTHON][SS] Cast NumPy instances to Python primitive types in GroupState update

HyukjinKwon commented on code in PR #38796:
URL: https://github.com/apache/spark/pull/38796#discussion_r1031978107


##########
python/pyspark/sql/streaming/state.py:
##########
@@ -130,6 +131,10 @@ def update(self, newValue: Tuple) -> None:
         if newValue is None:
             raise ValueError("'None' is not a valid state value")
 
+        if has_numpy:
+            import numpy as np
+            # In order to convert NumPy types to Python primitive types.
+            newValue = tuple(v.tolist() for v in newValue if isinstance(v, np.generic))

Review Comment:
   @xinrong-meng mind reviewing this please?



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