Open Etienne-Carriere opened 2 years ago
So do I. An alternative way is using tags.value[ indexOf(tags.key, 'some key') ]
.
I'm not saying that this is the best solution, but it works.
As an example:
CREATE MATERIALIZED VIEW IF NOT EXISTS jaeger.adapter_search_materialized ON CLUSTER '{cluster}'
TO jaeger.adapter_search_local AS SELECT
timestamp,
resource,
argUseCache,
traceId,
toDate(_tripDate) AS tripDate,
tripDirection,
tripSource,
toUInt16OrZero(_tripCount) AS tripCount,
tripSearchId,
durationUs
FROM (
SELECT
timestamp,
toInt32(tags.value[ indexOf(tags.key, 'resource.code') ]) AS resource,
toBool(tags.value[ indexOf(tags.key, 'use_cache') ] != 'false') AS argUseCache,
traceID AS traceId,
splitByChar(',', tags.value[ indexOf(tags.key, 'trip.date') ]) AS _tripDate,
splitByChar(',', tags.value[ indexOf(tags.key, 'trip.direction') ]) AS tripDirection,
splitByChar(',', tags.value[ indexOf(tags.key, 'trip.source') ]) AS tripSource,
splitByChar(',', tags.value[ indexOf(tags.key, 'trip.count') ]) AS _tripCount,
tags.value[ indexOf(tags.key, 'trip.search_id') ] AS tripSearchId,
durationUs
FROM jaeger.jaeger_index_local
WHERE operation = 'searchAndWaitResult'
) ARRAY JOIN _tripDate, tripDirection, tripSource, _tripCount
On jaeger_index tables, the tags is coded as a nested array with key and values. It is good for the only usage of Jaeger-query but in our company we are using jaeger also for analytics purposes. Since Clickhouse 21.3, the Map type (https://clickhouse.com/docs/en/sql-reference/data-types/map/) is available. I think It could be a good alternative to Nested .
Do you have already made some performance (time and storage) tests with Map ? Could it be an acceptable contribution (with a flag to not activate it by default) ?