Skip to content

JSON schema filter distribution groups by Dynamic attribute paths #2482

Description

@mfroembgen

Summary

With ClickStack/HyperDX JSON schema mode enabled, filter value/distribution queries can fail for JSON-backed OTel attribute paths because HyperDX emits untyped JSON path expressions and then groups/aggregates over them.

Example error

Data types Variant/Dynamic are not allowed in GROUP BY keys

Example generated query shape

SELECT ResourceAttributes.k8s.namespace.name AS __hdx_value, count() AS __hdx_count
FROM default.otel_logs
GROUP BY __hdx_value

In ClickHouse, that path is Dynamic(max_types=8), so grouping fails. A typed JSON path works instead:

ResourceAttributes.`k8s`.`namespace`.`name`.:String

A related key-values query can also fail when map-style access is used against a JSON column:

ResourceAttributes['k8s.namespace.name']

Environment

  • HyperDX 2.28.0
  • ClickHouse 26.5.1.882
  • BETA_CH_OTEL_JSON_SCHEMA_ENABLED=true
  • HYPERDX_OTEL_EXPORTER_CLICKHOUSE_JSON_ENABLE=true
  • otel_logs.ResourceAttributes is JSON(max_dynamic_types=8, max_dynamic_paths=64)

Upstream main appears to still pass raw key expressions into metadata/filter queries such as getValuesDistribution / getKeyValues.

Expected

For JSON attribute columns, HyperDX should render typed JSON subcolumn expressions, or otherwise cast to a stable type, before using them in GROUP BY, groupUniqArray, etc. Map columns should keep the existing bracket syntax.

I'd be open to contributing a fix if maintainers agree with this direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions