clickhouse-datasource: GroupArray function with tuple not supported?

Describe the bug

Unable to pass query with groupArray

SELECT t, groupArray((reason, c)) as reasons FROM ( SELECT toStartOfFiveMinute(record_datetime) AS t, JSONExtractInt(data, 'reason') AS reason, count(*) AS c FROM hepic_data.sip_transaction_call WHERE record_datetime >= toDateTime(1660711612) AND JSONExtractInt(data, 'reason') > 0 AND JSONExtractInt(data, 'reason') != 16 AND JSONExtractInt(data, 'reason') != 17 AND JSONExtractInt(data, 'reason') != 31 GROUP BY t, reason ORDER BY t, reason ) group by t order by t returns sql: Scan error on column index 1, name "isdnReasons": unsupported Scan, storing driver.Value type [][]interface {} into type *string: Could not process SQL results

If I wrap toString around group array I get the data I want but in a format I can’t seen to wrangle grafana to time visualization to support

2022-08-17 06:30:00 | [(20,2),(21,2),(102,2)]

Versions Grafana and Plugin versions.

Grafana 9.0.3 Clickhouse 1.1.2.

Expected behavior

When performing this with the vertmedia plugin and the clickhouse endpoint the group array is returned as follows:

image

Which allows rendering via the timeseries. The expected behaviour would be to be able to use the same query in the official clickhouse plugin.

Additional context

I’m pretty sure if I wrangled hard enough I could get this working straight from the clickhouse query, but it would be great if this worked out of the box.

Any help greatly appreciated 😃

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (1 by maintainers)

Most upvoted comments

I do not want to highjack this thread but the very basic use case for the groupAray function is to get e.g. multiple values for the same timestamp - sounds quite bizarre at first but can be used to provide anti-aliasing. For technical application it is super important.

reduced example of a query that works with Altinity plugin but does not in the Grafana Labs one: image