Skip to content

fix: quote numeric-looking ad-hoc values when the column type is unknown (#794) - #950

Merged
Slach merged 4 commits into
masterfrom
fix/794-map-numeric-adhoc
Nov 3, 2026
Merged

Slach merged 4 commits into
masterfrom
fix/794-map-numeric-adhoc

Conversation

@lunaticusgreen

Copy link
Copy Markdown
Collaborator

fix #794

…own (#794)

Schema-aware quoting (#909) fixed `_map['code'] = 200` only when column
introspection resolves the key. Other keys fall back to formatAdhocScalar,
which guessed from the value shape and emitted the string "200" bare.
ClickHouse rejects that for String and Map(String, String) columns
("There is no supertype for types String, UInt8"). The fallback handles
every db.table.col key, the form the ad-hoc key picker offers by default
(`default.test_grafana.country = 200`), and db.table-qualified Map keys
(`default.logs._map['code'] = 200`).

Ad-hoc values from Grafana are strings, so quote them in that fallback.
A quoted constant still compares correctly against numeric, DateTime,
Bool and Enum columns because ClickHouse casts the constant (verified on
26.8: UInt64 = '200', UInt8 > '3', DateTime = '1700000000', Bool = '1',
Date = '20240101'); a bare number never works against String columns.

Remaining edge: a hand-typed value that is not a canonical integer, such
as '007', '7.0' or ' 200 ', on an integer column of unknown type now
fails with TYPE_MISMATCH where the bare form used to pass.
@Slach Slach added this to the 3.6.0 milestone Oct 26, 2026
@Slach
Slach merged commit e569338 into master Nov 3, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

numeric values in Map(String,String) log [+]/[-] adhoc filters, broke queries

2 participants