fix(attribute-values): Handle boolean attributes#8000
Open
wmak wants to merge 2 commits into
Open
Conversation
Member
wmak
commented
Jun 4, 2026
- The endpoint allows attribute values but currently breaks because it makes some assumptions where the value would be a string. This fixes those cases so that we can use this endpoint for booleans
- The endpoint allows attribute values but currently breaks because it makes some assumptions where the value would be a string. This fixes those cases so that we can use this endpoint for booleans
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5928272. Configure here.
Comment on lines
+64
to
+66
| [ | ||
| f.has(column("attributes_bool"), name) | ||
| for name in _map_key_names_for_existence_check(request.key) |
Contributor
There was a problem hiding this comment.
Bug: The code uses f.has() on the attributes_bool map, which translates to an incorrect ClickHouse function (has() instead of mapContains()), causing query failures.
Severity: HIGH
Suggested Fix
Replace the call to f.has(column("attributes_bool"), name) with f.mapContains(column("attributes_bool"), name). This will generate the correct mapContains() function in the ClickHouse query, which is designed to work with Map data types.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: snuba/web/rpc/v1/trace_item_attribute_values.py#L64-L66
Potential issue: The code uses `f.has(column("attributes_bool"), name)` to query a map
column. However, the query processor `HashMapHasFunctionTransformer` is not configured
to handle the `attributes_bool` column. As a result, the function call is passed
directly to ClickHouse as `has(attributes_bool, 'attribute_name')`. The ClickHouse
`has()` function is designed for arrays, not maps. The correct function for checking key
existence in a map is `mapContains()`. This will cause a runtime type error in
ClickHouse whenever a query for a boolean attribute is executed, breaking the feature.
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.
