Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion osprey_worker/src/osprey/worker/ui_api/osprey/lib/clickhouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,21 @@ def execute(self, backend: ClickHouseQueryBackend) -> List[Dict[str, Any]]:
ORDER BY `timestamp` ASC
"""

return backend.query(sql)
rows = backend.query(sql)
# Reshape flat ClickHouse rows into the Druid-era envelope the UI and
# `entities.py::event_counts_by_feature_for_entity_query` both consume.
# UI reads `point.result.count` (osprey_ui Timeseries.tsx:108); the
# TimeseriesResult type in osprey_ui/src/types/QueryTypes.tsx declares
# `result: { count: number; [key: string]: number }` to carry either a
# plain count or the per-dimension aggregations this query can emit
# (the aggregation_dimensions branch above).
return [
{
'timestamp': row['timestamp'],
'result': {k: v for k, v in row.items() if k != 'timestamp'},
}
for row in rows
]


class GroupByApproximateCountClickHouseQuery(BaseClickHouseQuery):
Expand Down
Loading