Interface GrowableOffsetRangeTracker.RangeEndEstimator
- Enclosing class:
GrowableOffsetRangeTracker
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
estimate()
is called to give the end offset when GrowableOffsetRangeTracker.trySplit(double)
or GrowableOffsetRangeTracker.getProgress()
is invoked. The end offset is exclusive for the range. The estimated end is not
required to monotonically increase as it will only be taken into consideration when the
estimated end offset is larger than the current position. Returning Long.MAX_VALUE
as
the estimate implies the largest possible position for the range is Long.MAX_VALUE - 1
.
Return Long.MIN_VALUE
if an estimate can not be provided.
Providing a good estimate is important for an accurate progress signal and will impact splitting decisions by the runner.
If estimate()
is expensive to compute, consider wrapping the implementation with
Suppliers.memoizeWithExpiration(org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.base.Supplier<T>, long, java.util.concurrent.TimeUnit)
or equivalent as an optimization.
TODO(https://github.com/apache/beam/issues/20227): Also consider using GrowableOffsetRangeTracker.RangeEndEstimator
when the range is not ended with Long.MAX_VALUE
.
-
Method Summary
-
Method Details
-
estimate
long estimate()
-