acrites commented on code in PR #41692:
URL: https://github.com/apache/beam/pull/41692#discussion_r4744720052
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/util/common/ElementByteSizeObserver.java:
##########
@@ -66,14 +81,25 @@ public void setScalingFactor(double scalingFactor) {
@Override
public void update(Observable obs, Object obj) {
if (obj instanceof Long) {
- totalSize += (long) (scalingFactor * (Long) obj);
+ update(((Long) obj).longValue());
} else if (obj instanceof Integer) {
- totalSize += (long) (scalingFactor * (Integer) obj);
+ update(((Integer) obj).longValue());
} else {
throw new AssertionError("unexpected parameter object");
}
}
+ /**
+ * Resets any accumulated byte size, lazy state, and scaling factor to
{@code 1.0} without
+ * reporting. Unlike {@link #advance()}, this clears the scaling factor so a
reused observer does
+ * not inherit a prior element's scaling factor.
+ */
+ public void reset() {
Review Comment:
Ditto. This change has been reverted.
--
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]