Slackbot
01/25/2024, 12:29 PMKyle Hoondert
01/25/2024, 12:47 PMLAST_VALUE as a Druid SQL function - are you looking for LATEST ? https://druid.apache.org/docs/latest/querying/sql-functionsJohn Masvongo
01/25/2024, 1:58 PMKyle Hoondert
01/25/2024, 2:00 PMLATEST and you have LASTESTMike Sherman
01/25/2024, 2:04 PMSELECT
DATE_TRUNC('PT5M',"__time") as time_interval,
LATEST("added") as added,
SUM("commentLength") as commentLength
FROM
"wikipedia"
WHERE
"channel" = '#sv.wikipedia'
AND "__time" >= TIMESTAMP '2016-01-01 09:30:00'
AND "__time" < TIMESTAMP '2017-01-24 16:30:00'
GROUP BY
DATE_TRUNC('PT5M',"__time")
And I get the UNCATEGORIZED (ADMIN) error. Let me play around with that query, at least we have a use case that can be run by anyone with the Wikipedia dataset...Kyle Hoondert
01/25/2024, 2:06 PMSELECT
TIME_FLOOR("__time",'PT5M') as time_interval,
LATEST("comment") as price,
SUM("commentLength") as volume
FROM
"wikipedia"
WHERE
"channel" = '#en.wikipedia'
AND "__time" >= TIMESTAMP '2015-01-24 09:30:00'
AND "__time" < TIMESTAMP '2024-01-24 16:30:00'
GROUP BY 1Mike Sherman
01/25/2024, 2:07 PMKyle Hoondert
01/25/2024, 2:08 PMMike Sherman
01/25/2024, 2:11 PMDATE_TRUNC('PT5M',"__time") as time_interval
to
__time as time_interval
and add __time to the GROUP BYKyle Hoondert
01/25/2024, 2:18 PMDATE_TRUNC so I switched mine to a TIME_FLOOR 🤷John Masvongo
01/25/2024, 2:20 PMKyle Hoondert
01/25/2024, 2:24 PMSELECT
TIME_FLOOR(__time,'PT5M') as time_interval,
LATEST("lasttrade") as price,
SUM("lasttradesize") as volume
FROM
"stocks_intervals"
WHERE
"symbol" = 'TSLA'
AND "__time" >= TIMESTAMP '2024-01-24 09:30:00'
AND "__time" < TIMESTAMP '2024-01-24 16:30:00'
GROUP BY 1
should work?John Masvongo
01/25/2024, 2:26 PMMike Sherman
01/25/2024, 3:42 PMAbhishek Agarwal
01/25/2024, 4:00 PMMike Sherman
01/25/2024, 4:35 PMMike Sherman
01/25/2024, 4:48 PM