GrafanaCassandraDatasource icon indicating copy to clipboard operation
GrafanaCassandraDatasource copied to clipboard

Support non timestamp type time field

Open peter146d opened this issue 3 years ago • 1 comments

It's realy a great work, but unfortunately i had a legacy cassandra table that use "bigint" as the only "Time Column" and it seemed the "Time Column" only support "timestamp" type.

It would be great if it can support "$__unixEpochFrom" and "$__unixEpochFrom" such as other database data source.

Thank You.

peter146d avatar Jun 30 '21 12:06 peter146d

A workaround could be to use blobAsTimestamp(bigintAsBlob(someColumn)). See https://docs.datastax.com/en/cql-oss/3.3/cql/cql_reference/blob_r.html.

cnoelle avatar Aug 03 '21 13:08 cnoelle

@unflag This one is closed by #172, is it?

HadesArchitect avatar Oct 11 '23 21:10 HadesArchitect

Not exactly, unfortunately. There are two problems:

  • Support $__unixEpochFrom/$__unixEpochTo macros to use their values in query, which should be easy to implement.
  • Convert returned bigint value to timestamp, because without this grafana will consider it a value, not a time. And there is a question - how to decide which numeric value in a row is a timestamp and which is a numeric value? I guess, we should rely on cassandra functions and convert types in query, not in datasource.

unflag avatar Oct 11 '23 22:10 unflag

Theoretically we can decide based on the argument's order, can we?

HadesArchitect avatar Oct 12 '23 06:10 HadesArchitect