Skip to content

Instantly share code, notes, and snippets.

@kgorman
Created June 7, 2019 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kgorman/a921e3f2fa1595c4a6a349a77465a92d to your computer and use it in GitHub Desktop.
Save kgorman/a921e3f2fa1595c4a6a349a77465a92d to your computer and use it in GitHub Desktop.
sample fraud query
-- fraud processing on a stream of auths from a point of sale
SELECT card,
MAX(amount) as max_amount,
TUMBLE_END(eventTimestamp, interval '5' minute) as ts,
lat,
lon
FROM auth
GROUP BY card, TUMBLE(eventTimestamp, interval '5' minute)
HAVING COUNT(*) > 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment