Skip to content

Commit

Permalink
Core, Flink: Fix build warnings (apache#10899)
Browse files Browse the repository at this point in the history
  • Loading branch information
nk1506 authored Aug 9, 2024
1 parent d17a7f1 commit 79620e1
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ private <T> boolean fileContent(BoundReference<T> ref) {
return ref.fieldId() == DataFile.CONTENT.fieldId();
}

private <T> boolean contentMatch(Integer fileContentId) {
private boolean contentMatch(Integer fileContentId) {
if (FileContent.DATA.id() == fileContentId) {
return ManifestContent.DATA.id() == manifestContentId;
} else if (FileContent.EQUALITY_DELETES.id() == fileContentId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ protected long numOutputFiles(long inputSize) {
// the remainder file is of a valid size for this rewrite so keep it
return numFilesWithRemainder;

} else if (avgFileSizeWithoutRemainder < Math.min(1.1 * targetFileSize, writeMaxFileSize())) {
} else if (avgFileSizeWithoutRemainder
< Math.min(1.1 * targetFileSize, (double) writeMaxFileSize())) {
// if the reminder is distributed amongst other files,
// the average file size will be no more than 10% bigger than the target file size
// so round down and distribute remainder amongst other files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public TimeValue getRetryInterval(HttpResponse response, int execCount, HttpCont
}
}

int delayMillis = 1000 * (int) Math.min(Math.pow(2.0, (long) execCount - 1), 64.0);
int delayMillis = 1000 * (int) Math.min(Math.pow(2.0, (long) execCount - 1.0), 64.0);
int jitter = ThreadLocalRandom.current().nextInt(Math.max(1, (int) (delayMillis * 0.1)));

return TimeValue.ofMilliseconds(delayMillis + jitter);
Expand Down
5 changes: 0 additions & 5 deletions core/src/main/java/org/apache/iceberg/util/Pair.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ public Schema load(Pair<Class<?>, Class<?>> key) {
private X first;
private Y second;

/** Constructor used by Avro */
private Pair(Schema schema) {
this.schema = schema;
}

private Pair(X first, Y second) {
this.first = first;
this.second = second;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ private ParallelIterator(
}

@Override
@SuppressWarnings("FutureReturnValueIgnored")
public void close() {
// close first, avoid new task submit
this.closed.set(true);
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/java/org/apache/iceberg/util/Tasks.java
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,9 @@ private <E extends Exception> void runTaskWithRetry(Task<I, E> task, I item) thr
}

int delayMs =
(int) Math.min(minSleepTimeMs * Math.pow(scaleFactor, attempt - 1), maxSleepTimeMs);
(int)
Math.min(
minSleepTimeMs * Math.pow(scaleFactor, attempt - 1), (double) maxSleepTimeMs);
int jitter = ThreadLocalRandom.current().nextInt(Math.max(1, (int) (delayMs * 0.1)));

LOG.warn("Retrying task after failure: {}", e.getMessage(), e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public ViewMetadata refresh() {
}

@Override
@SuppressWarnings("ImmutablesReferenceEquality")
public void commit(ViewMetadata base, ViewMetadata metadata) {
// if the metadata is already out of date, reject it
if (base != current()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.iceberg.flink.sink.shuffle;

import java.nio.charset.StandardCharsets;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -139,7 +140,7 @@ private static String randomString(String prefix) {
buffer[i] = (byte) CHARS.charAt(ThreadLocalRandom.current().nextInt(CHARS.length()));
}

return prefix + new String(buffer);
return prefix + new String(buffer, StandardCharsets.UTF_8);
}

/** find the index where weightsUDF[index] < weight && weightsUDF[index+1] >= weight */
Expand Down

0 comments on commit 79620e1

Please sign in to comment.