Skip to content

Commit

Permalink
Multiply safely
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Jul 16, 2021
1 parent 6cfcfc5 commit 6428a88
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import static io.trino.testing.TestingConnectorSession.SESSION;
import static io.trino.type.ColorType.COLOR;
import static java.lang.Float.floatToRawIntBits;
import static java.lang.Math.multiplyExact;
import static java.util.Objects.requireNonNull;
import static org.testng.Assert.assertEquals;

Expand Down Expand Up @@ -533,7 +534,7 @@ public static Block createTimestampSequenceBlock(int start, int end)
BlockBuilder builder = TIMESTAMP_MILLIS.createFixedSizeBlockBuilder(end - start);

for (int i = start; i < end; i++) {
TIMESTAMP_MILLIS.writeLong(builder, i * MICROSECONDS_PER_MILLISECOND);
TIMESTAMP_MILLIS.writeLong(builder, multiplyExact(i, MICROSECONDS_PER_MILLISECOND));
}

return builder.build();
Expand Down

0 comments on commit 6428a88

Please sign in to comment.