HyukjinKwon commented on code in PR #59197:
URL: https://github.com/apache/spark/pull/59197#discussion_r4172087515
##########
core/src/main/scala/org/apache/spark/util/SizeEstimator.scala:
##########
@@ -270,7 +270,7 @@ object SizeEstimator extends Logging {
val s2 = sampleArray(array, state, rand, drawn, length)
val size = math.min(s1, s2)
state.size += math.max(s1, s2) +
- (size * ((length - ARRAY_SAMPLE_SIZE) / ARRAY_SAMPLE_SIZE))
+ size * (length - ARRAY_SAMPLE_SIZE) / ARRAY_SAMPLE_SIZE
Review Comment:
Optional nit: make the multiply-before-divide grouping explicit. The fix is
correct because `*` and `/` are left-associative, but the original bug was
exactly a grouping error here, so explicit parens document the intent and guard
against a future reorder silently reintroducing the `Int` truncation.
```suggestion
(size * (length - ARRAY_SAMPLE_SIZE)) / ARRAY_SAMPLE_SIZE
```
--
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]