vertica / vertica-grafana-datasource

Official Vertica datasource plugin for Grafana.
https://grafana.com/grafana/plugins/vertica-grafana-datasource/
Apache License 2.0
3 stars 9 forks source link

$__time macro doesn't work with nested date/time functions #9

Closed verticacrossman closed 2 years ago

verticacrossman commented 3 years ago

Customer reported: Grafana 7.3.2 and plugin version 0.2.0 with Vertica 9.x and 10.x $__time macro doesn't work with nested date/time functions

select date_trunc('HOUR', current_timestamp)) renders a Unix epoch number vs timestamp value

Adding the plugin macro $time to return Grafana required "time" column name select $time(current_timestamp) renders correct in a Grafana table using Format As "Table" select $__time(current_timestamp) renders nothiing in a Grafana table using Format As "Time Series"

Adding a nesting of the original column inside a date/time function (e.g. date_trunc, time_slice, date_part, etc.) select $__time(date_trunc('HOUR', current_timestamp)) renders an error "Error: [42601] Syntax error at or near "AS"" in a Grafana table using Format As "Table" and "Time Series"

Workaround using "as time" vs the $__time macro select date_trunc('HOUR', current_timestamp) as time renders correct timestamp in Grafana using Format As "Table" and "Time Series"