fix: chart data preview for dimension-less charts#1356
Open
sentry[bot] wants to merge 1 commit into
Open
Conversation
Author
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1356 +/- ##
==========================================
- Coverage 58.66% 58.62% -0.05%
==========================================
Files 132 132
Lines 15690 15704 +14
==========================================
+ Hits 9205 9206 +1
- Misses 6485 6498 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
This PR addresses issue DALGO-BACKEND-1VX, where a
ValueErrorwas raised in the/api/charts/chart-data-preview/endpoint for chart types that do not require dimensions (e.g., 'number' charts).Root Cause:
The
get_chart_data_preview()function incharts_api.pyunconditionally calledcharts_service.get_chart_data_table_preview(). This function, as its name implies, is designed for table charts and explicitly requires at least one dimension. For chart types like 'number' that only display aggregated metrics and have no dimensions, this led to aValueErrorwhennormalize_dimensions()returned an empty list.Solution:
The implementation now branches the logic within
get_chart_data_preview():payload.chart_typeis 'table', it continues to usecharts_service.get_chart_data_table_preview().charts_service.build_chart_query()andcharts_service.execute_chart_query()to fetch the data. This path correctly handles charts without explicit dimensions. The results are then formatted into aDataPreviewResponsecompatible structure.This change ensures that all chart types can be previewed successfully without encountering the
ValueErrorrelated to missing dimensions.Fixes DALGO-BACKEND-1VX