Map attribute columns are labelled `arrayElement(LogAttributes, 'key')` in the results table instead of the field name
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 9.9k
- Forks
- 471
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 117
Description
Selecting a map attribute as a column labels it with the raw ClickHouse function form. A user who adds LogAttributes['constructor.index_builder_ac_res_id'] gets a results-table header reading:
arrayElement(LogAttributes, 'constructor.index_builder_ac_res_id')
At our column widths that header is wider than the value it sits over, and several such columns make the table unreadable. The same string shows up in the SELECT box and in chart legends.
Cause. The generated SQL emits the subscript expression with no alias, so ClickHouse names the result column with the canonical function form. That naming is ClickHouse behaviour, not a bug — it happens for any unaliased Map subscript:
DESCRIBE (SELECT LogAttributes['constructor.index_builder_ac_res_id'],
ResourceAttributes['service.name']
FROM otel.otel_logs LIMIT 0)
arrayElement(LogAttributes, 'constructor.index_builder_ac_res_id') String
arrayElement(ResourceAttributes, 'service.name') String
Expected. The column is labelled with the field name the user picked — constructor.index_builder_ac_res_id, or LogAttributes.constructor.index_builder_ac_res_id if the prefix is wanted for disambiguation. Adding AS to the generated select is enough; the display name is already known at the point the SQL is built.
Environment. ClickHouse Cloud 26.4.1.2212, Map(LowCardinality(String), String) attribute columns, standard OTel logs schema.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the SQL-generation path for map-attribute column selections, where the selected field name is already available. Confirm how the generated SELECT is used by the results table, SELECT box, and chart legends, then verify that each displays the chosen field name rather than ClickHouse’s raw arrayElement form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clickhouse, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100