jiangxb1987 commented on a change in pull request #27968: 
[SPARK-31202][CORE]Improve SizeEstimator for AppendOnlyMap
URL: https://github.com/apache/spark/pull/27968#discussion_r396914873
 
 

 ##########
 File path: 
core/src/main/scala/org/apache/spark/util/collection/AppendOnlyMap.scala
 ##########
 @@ -145,10 +161,15 @@ class AppendOnlyMap[K, V](initialCapacity: Int = 64)
         data(2 * pos) = k
         data(2 * pos + 1) = newValue.asInstanceOf[AnyRef]
         incrementSize()
+        keyPositions.set(2 * pos)
+        totalValueElements += 1
         return newValue
       } else if (k.eq(curKey) || k.equals(curKey)) {
         val newValue = updateFunc(true, data(2 * pos + 1).asInstanceOf[V])
         data(2 * pos + 1) = newValue.asInstanceOf[AnyRef]
+        if (updateValueElements.isDefinedAt(valueClassTag.runtimeClass)) {
 
 Review comment:
   This is hard to understand, why not just match class type?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to