HyukjinKwon commented on a change in pull request #34363:
URL: https://github.com/apache/spark/pull/34363#discussion_r734240778



##########
File path: python/pyspark/accumulators.py
##########
@@ -176,44 +193,44 @@ class AccumulatorParam(object):
     [7.0, 8.0, 9.0]
     """
 
-    def zero(self, value):
+    def zero(self, value: T) -> T:
         """
         Provide a "zero value" for the type, compatible in dimensions with the
         provided `value` (e.g., a zero vector)
         """
         raise NotImplementedError
 
-    def addInPlace(self, value1, value2):
+    def addInPlace(self, value1: T, value2: T) -> T:
         """
         Add two values of the accumulator's data type, returning a new value;
         for efficiency, can also update `value1` in place and return it.
         """
         raise NotImplementedError
 
 
-class AddingAccumulatorParam(AccumulatorParam):
+class AddingAccumulatorParam(AccumulatorParam[U]):
 
     """
     An AccumulatorParam that uses the + operators to add values. Designed for 
simple types
     such as integers, floats, and lists. Requires the zero value for the 
underlying type
     as a parameter.
     """
 
-    def __init__(self, zero_value):
+    def __init__(self, zero_value: U):
         self.zero_value = zero_value
 
-    def zero(self, value):
+    def zero(self, value: U) -> U:
         return self.zero_value
 
-    def addInPlace(self, value1, value2):
-        value1 += value2
+    def addInPlace(self, value1: U, value2: U) -> U:
+        value1 += value2  # type: ignore[operator]

Review comment:
       @dchvn let's make sure explain why these are ignored to make the review 
easier.




-- 
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-unsubscr...@spark.apache.org

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



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

Reply via email to