Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(spans): Add group_raw to HexIntColumnProcessor #4459

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion snuba/datasets/configuration/spans/storages/spans.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ query_processors:
columns: [transaction_id, trace_id]
- processor: HexIntColumnProcessor
args:
columns: [span_id, parent_span_id, segment_id, group]
columns: [span_id, parent_span_id, segment_id, group, group_raw]
- processor: MappingOptimizer
args:
column_name: tags
Expand Down
20 changes: 20 additions & 0 deletions tests/test_spans_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,23 @@ def test_granularity_processor_gets_applied(self) -> None:
data = json.loads(response.data)
assert response.status_code == 200, response.data
assert data["sql"].startswith("SELECT (toStartOfHour(end_timestamp")

def test_hex_int_column_processor_gets_applied_to_group_raw(self) -> None:
from_date = (self.base_time - self.skew).isoformat()
to_date = (self.base_time + self.skew).isoformat()
response = self._post_query(
f"""MATCH (spans)
SELECT group_raw,
count() AS aggregate
BY group_raw
WHERE project_id = 1
AND timestamp >= toDateTime('{from_date}')
AND timestamp < toDateTime('{to_date}')
GRANULARITY 60
"""
)
data = json.loads(response.data)
assert response.status_code == 200, response.data
assert data["sql"].startswith(
"SELECT (lower(hex(group_raw)) AS _snuba_group_raw)"
)