SAMPLE_POISSON()

All functions > BUSINESS > SAMPLE_POISSON()

Returns an integer drawn from a Poisson distribution with the given rate, based on the given hashing key.

Signatures

Returns: Deterministic non-negative integer from Poisson distribution

SAMPLE_POISSON(hashing_key: VARCHAR, rate: DOUBLE) → BIGINT
sql
ParameterTypeRequiredDescription
hashing_keyVARCHARYesString value to hash (typically user ID or session ID)
rateDOUBLEYesRate parameter λ (> 0). Also the mean and variance of the distribution.

Notes

  • Deterministic - same key always produces same value
  • Uses inverse CDF method with Horner-form polynomial evaluation
  • Output is a non-negative integer (count of events)
  • Accurate for rate up to ~20 (covers 99.999%+ of probability mass)
  • For rate > 20, output is capped at 40 (tail truncation)
  • Models event counts per interval (arrivals, defects, requests)
  • Common for demand forecasting, queue depth simulation
  • Rate must be strictly positive

Examples

FeatureQL
SELECT
    f1 := SAMPLE_POISSON('k', 5E0) -- Poisson draw with rate 5 for a fixed key
;
Result
f1 BIGINT
5

Last update at: 2026/05/26 17:22:09