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
| Parameter | Type | Required | Description |
|---|---|---|---|
hashing_key | VARCHAR | Yes | String value to hash (typically user ID or session ID) |
rate | DOUBLE | Yes | Rate 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 |
On this page