Repository navigation
fix: quote numeric-looking ad-hoc values when the column type is unknown (#794) - #950
Merged
Merged
Conversation
…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.
…fix/794-map-numeric-adhoc
…fix/794-map-numeric-adhoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #794