Skip to content

Commit

Permalink
API, Flink, ORC: Fix implicit long casting issues (apache#10580)
Browse files Browse the repository at this point in the history
  • Loading branch information
snazy authored Jul 3, 2024
1 parent d255c87 commit 3825477
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void testMultipleThreadWriters() throws InterruptedException {
try {
barrier.await(30, SECONDS);
for (int i = 1; i <= 100; ++i) {
histogram.update(threadIndex * samplesPerThread + i);
histogram.update((long) threadIndex * samplesPerThread + i);
}
return threadIndex;
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ public TimestampData read(TimestampData ignored) {
long value = readLong();
return TimestampData.fromLocalDateTime(
Instant.ofEpochSecond(
Math.floorDiv(value, 1000_000), Math.floorMod(value, 1000_000) * 1000)
Math.floorDiv(value, 1000_000), Math.floorMod(value, 1000_000) * 1000L)
.atOffset(ZoneOffset.UTC)
.toLocalDateTime());
}
Expand All @@ -444,7 +444,7 @@ public TimestampData read(TimestampData ignored) {
long value = readLong();
return TimestampData.fromInstant(
Instant.ofEpochSecond(
Math.floorDiv(value, 1000_000), Math.floorMod(value, 1000_000) * 1000));
Math.floorDiv(value, 1000_000), Math.floorMod(value, 1000_000) * 1000L));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected List<IcebergSourceSplit> createSplits(
.mapToObj(
fileNum ->
RandomGenericData.generate(
SCHEMA, 2, splitNum * filesPerSplit + fileNum))
SCHEMA, 2, (long) splitNum * filesPerSplit + fileNum))
.collect(Collectors.toList())))
.collect(Collectors.toList());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ private <T> Object literal(Type icebergType, T icebergLiteral) {
return Timestamp.from(
Instant.ofEpochSecond(
Math.floorDiv(microsFromEpoch, 1_000_000),
Math.floorMod(microsFromEpoch, 1_000_000) * 1_000));
Math.floorMod(microsFromEpoch, 1_000_000) * 1_000L));
case DECIMAL:
return new HiveDecimalWritable(HiveDecimal.create((BigDecimal) icebergLiteral, false));
default:
Expand Down

0 comments on commit 3825477

Please sign in to comment.