So I was playing around with some SQL querying the
SYS tables for this druid-user question:
And I came up with this madness:
CAST (LEFT(created_time,10) || ' ' || RIGHT(LEFT(created_time,19),8) AS TIMESTAMP) AS __time,
I couldn’t get
SUBSTRING to work on the
created_time to extract the time only, and it also doesn’t handle timezones (if it needs to??)
Does anyone else have any ideas of a good way to get the date fields in SYS tables into a timestamp?
It is a notorious set of fields, the SYS tables have. They don’t adhere to string or Time functions.
One of the ways is to use ordering,
ORDER BY "created_time " DESC
[quote=“[druid-user] Druid SQL Query top of sys.tasks, post:4, topic:7667”]
SELECT CAST (LEFT(created_time,10) || ’ ’ || RIGHT(LEFT(created_time,19),8) AS TIMESTAMP) AS …
Substring should technically work as it is a standard function. But I tried it and it does give me an error. Maybe a regression?