Skip to content

Instantly share code, notes, and snippets.

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 mbergal/7aac30619884c0aaacb9d73b8c04f729 to your computer and use it in GitHub Desktop.
Save mbergal/7aac30619884c0aaacb9d73b8c04f729 to your computer and use it in GitHub Desktop.
SELECT structPayload.sessionId, SUM(failures) failures, SUM(restores) restores
FROM
(
SELECT
structPayload.sessionId,
CASE WHEN structPayload.event = 'failure' THEN 1
ELSE 0 END as failures,
CASE WHEN structPayload.event = 'restored' THEN 1
ELSE 0 END as restores
FROM [aaa.aaaaa_20160501]
WHERE metadata.labels.value = 'express'
ORDER BY metadata.timestamp desc LIMIT 1000
) a
GROUP BY structPayload.sessionId
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment