HyukjinKwon opened a new pull request, #38796:
URL: https://github.com/apache/spark/pull/38796

   ### What changes were proposed in this pull request?
   
   This PR proposes to cast NumPy instances in `GroupState.update`.  
Previously, if we pass a NumPy instance to `GroupState.update`, then it failed 
with an exception as below:
   
   ```
   net.razorvine.pickle.PickleException: expected zero arguments for 
construction of ClassDict (for numpy.dtype). This happens when an 
unsupported/unregistered class is being unpickled that requires construction 
arguments. Fix it by registering a custom IObjectConstructor for this class.
        at 
net.razorvine.pickle.objects.ClassDictConstructor.construct(ClassDictConstructor.java:23)
        at net.razorvine.pickle.Unpickler.load_reduce(Unpickler.java:759)
        at net.razorvine.pickle.Unpickler.dispatch(Unpickler.java:199)
        at net.razorvine.pickle.Unpickler.load(Unpickler.java:109)
        at net.razorvine.pickle.Unpickler.loads(Unpickler.java:122)
        at 
org.apache.spark.sql.api.python.PythonSQLUtils$.$anonfun$toJVMRow$1(PythonSQLUtils.scala:125)
   ```
   
   ### Why are the changes needed?
   
   `applyInPandasWithState` uses pandas instances so it is very common to 
extract a NumPy instance from the pandas and set it to the group state.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No because this new API is not released yet.
   
   ### How was this patch tested?
   
   Manually tested, and unittest was added.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to