Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some long casting issues #10580

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix some long casting issues
  • Loading branch information
snazy committed Jun 28, 2024
commit 13f527b2cc1bf00be65d55015fad561732700582
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just keep in mind you'll want to backport this to the previous Flink versions

.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