Skip to content

Instantly share code, notes, and snippets.

@a1mzone
Last active April 14, 2025 14:05
Show Gist options
  • Save a1mzone/39f6083d850e561a981c1bb15547a290 to your computer and use it in GitHub Desktop.
Save a1mzone/39f6083d850e561a981c1bb15547a290 to your computer and use it in GitHub Desktop.
Druid

Apache Druid

Query

SELECT 
    COUNT(*) AS total, 
    DATE_TRUNC('day', TIME_PARSE("created_at",'yyyy-MM-dd HH:mm:ss.S')) AS dom 
FROM source 
WHERE DATE_TRUNC('day', TIME_PARSE("created_at",'yyyy-MM-dd HH:mm:ss.S')) >= '2024-08-01' 
    AND DATE_TRUNC('day', TIME_PARSE("created_at",'yyyy-MM-dd HH:mm:ss.S')) < CURRENT_DATE 
GROUP BY DATE_TRUNC('day', TIME_PARSE("created_at",'yyyy-MM-dd HH:mm:ss.S'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment