Skip to content

Commit 500996f

Browse files
committed
Remove LongDoubleConversion from ErrorProne disabledChecks
1 parent 3197d88 commit 500996f

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1579,7 +1579,6 @@ class BeamModulePlugin implements Plugin<Project> {
15791579
"DirectInvocationOnMock",
15801580
"Finalize",
15811581
"JUnitIncompatibleType",
1582-
"LongDoubleConversion",
15831582
"MockNotUsedInProduction",
15841583
"NarrowCalculation",
15851584
"NullableTypeParameter",

sdks/java/core/src/main/java/org/apache/beam/sdk/io/Read.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ public void splitRestriction(
298298
desiredChunkSize = 64 << 20; // 64mb
299299
} else {
300300
// 1mb --> 1 shard; 1gb --> 32 shards; 1tb --> 1000 shards, 1pb --> 32k shards
301-
desiredChunkSize = Math.max(1 << 20, (long) (1000 * Math.sqrt(estimatedSize)));
301+
desiredChunkSize = Math.max(1 << 20, (long) (1000 * Math.sqrt((double) estimatedSize)));
302302
}
303303
List<BoundedSourceT> splits =
304304
(List<BoundedSourceT>) restriction.split(desiredChunkSize, pipelineOptions);
@@ -1079,7 +1079,7 @@ private Progress tryGetProgressOrThrow() throws IOException {
10791079
if (size != UnboundedReader.BACKLOG_UNKNOWN) {
10801080
// The UnboundedSource/UnboundedReader API has no way of reporting how much work
10811081
// has been completed so runners can only see the work remaining changing.
1082-
return Progress.from(0, size);
1082+
return Progress.from(0, (double) size);
10831083
}
10841084

10851085
// TODO: Support "global" backlog reporting

sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/ApproximateQuantiles.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ public ApproximateQuantilesCombineFn<T, ComparatorT> withEpsilon(double epsilon)
277277
* of {@code maxNumElements}.
278278
*/
279279
public ApproximateQuantilesCombineFn<T, ComparatorT> withMaxInputSize(long maxNumElements) {
280-
return create(numQuantiles, compareFn, maxNumElements, maxNumElements);
280+
return create(numQuantiles, compareFn, maxNumElements, (double) maxNumElements);
281281
}
282282

283283
/**
@@ -484,7 +484,8 @@ private QuantileBuffer<T> collapse(Iterable<QuantileBuffer<T>> buffers) {
484484
newLevel = Math.max(newLevel, buffer.level + 1);
485485
newWeight += buffer.weight;
486486
}
487-
List<T> newElements = interpolate(buffers, bufferSize, newWeight, offset(newWeight));
487+
List<T> newElements =
488+
interpolate(buffers, bufferSize, (double) newWeight, (double) offset(newWeight));
488489
return new QuantileBuffer<>(newLevel, newWeight, newElements);
489490
}
490491

sdks/java/core/src/main/java/org/apache/beam/sdk/util/FluentBackoff.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public long nextBackOffMillis() {
234234
Math.min(
235235
backoffConfig.initialBackoff.getMillis()
236236
* Math.pow(backoffConfig.exponent, currentRetry),
237-
backoffConfig.maxBackoff.getMillis());
237+
(double) backoffConfig.maxBackoff.getMillis());
238238
double randomOffset =
239239
(Math.random() * 2 - 1) * DEFAULT_RANDOMIZATION_FACTOR * currentIntervalMillis;
240240
long nextBackoffMillis = Math.round(currentIntervalMillis + randomOffset);

sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/splittabledofn/GrowableOffsetRangeTrackerTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public void testProgressAfterFinished() throws Exception {
183183
tracker.checkDone();
184184
simpleEstimator.setEstimateRangeEnd(0L);
185185
Progress currentProgress = tracker.getProgress();
186-
assertEquals(Long.MAX_VALUE - 10L, currentProgress.getWorkCompleted(), 0);
186+
assertEquals((double) (Long.MAX_VALUE - 10L), currentProgress.getWorkCompleted(), 0);
187187
assertEquals(0, currentProgress.getWorkRemaining(), 0.001);
188188
}
189189

@@ -197,23 +197,23 @@ public void testProgress() throws Exception {
197197

198198
simpleEstimator.setEstimateRangeEnd(5L);
199199
Progress currentProgress = tracker.getProgress();
200-
assertEquals(cur - start, currentProgress.getWorkCompleted(), 0.001);
200+
assertEquals((double) (cur - start), currentProgress.getWorkCompleted(), 0.001);
201201
assertEquals(0, currentProgress.getWorkRemaining(), 0.001);
202202

203203
simpleEstimator.setEstimateRangeEnd(35L);
204204
currentProgress = tracker.getProgress();
205-
assertEquals(cur - start, currentProgress.getWorkCompleted(), 0.001);
206-
assertEquals(35L - cur, currentProgress.getWorkRemaining(), 0.001);
205+
assertEquals((double) (cur - start), currentProgress.getWorkCompleted(), 0.001);
206+
assertEquals((double) (35L - cur), currentProgress.getWorkRemaining(), 0.001);
207207

208208
simpleEstimator.setEstimateRangeEnd(25L);
209209
currentProgress = tracker.getProgress();
210-
assertEquals(cur - start, currentProgress.getWorkCompleted(), 0.001);
211-
assertEquals(25L - cur, currentProgress.getWorkRemaining(), 0.001);
210+
assertEquals((double) (cur - start), currentProgress.getWorkCompleted(), 0.001);
211+
assertEquals((double) (25L - cur), currentProgress.getWorkRemaining(), 0.001);
212212

213213
simpleEstimator.setEstimateRangeEnd(Long.MAX_VALUE);
214214
currentProgress = tracker.getProgress();
215-
assertEquals(cur - start, currentProgress.getWorkCompleted(), 0.001);
216-
assertEquals(Long.MAX_VALUE - cur, currentProgress.getWorkRemaining(), 0.001);
215+
assertEquals((double) (cur - start), currentProgress.getWorkCompleted(), 0.001);
216+
assertEquals((double) (Long.MAX_VALUE - cur), currentProgress.getWorkRemaining(), 0.001);
217217
}
218218

219219
@Test

0 commit comments

Comments
 (0)