Skip to content

Commit

Permalink
Use non-blocking SecureRandom in noisy aggregators
Browse files Browse the repository at this point in the history
As a follow-up to #21290,
this one-line change ensures that the remaining noisy
aggregators (noisy_count_gaussian, noisy_count_if_gaussian,
noisy_avg_gaussian, noisy_sum_gaussian) all use a SecureRandom
provider that will not block and cause performance degradation.
  • Loading branch information
jonhehir authored and arhimondr committed Dec 1, 2023
1 parent a3946f5 commit 4c4712a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

import com.facebook.presto.common.block.BlockBuilder;
import com.facebook.presto.spi.PrestoException;
import com.facebook.presto.util.SecureRandomGeneration;

import java.security.SecureRandom;
import java.util.Random;

import static com.facebook.presto.common.type.BigintType.BIGINT;
Expand Down Expand Up @@ -71,7 +71,7 @@ public static void writeNoisyCountOutput(NoisyCountState state, BlockBuilder out

public static double getNoise(NoisyCountState state)
{
Random random = new SecureRandom();
Random random = SecureRandomGeneration.getNonBlocking();
if (!state.isNullRandomSeed()) {
random = new Random(state.getRandomSeed());
}
Expand Down

0 comments on commit 4c4712a

Please sign in to comment.