fix: prevent invalid bigint comparison with empty string in chart filters#1382
Draft
sentry[bot] wants to merge 1 commit into
Draft
fix: prevent invalid bigint comparison with empty string in chart filters#1382sentry[bot] wants to merge 1 commit into
sentry[bot] wants to merge 1 commit into
Conversation
Contributor
|
this we can close. |
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 a
DataError(psycopg2.errors.InvalidTextRepresentation) that occurred when an empty string ('') was used as a filter value for a numeric column (e.g.,bigint) in chart data previews. The root cause was that theapply_chart_filtersfunction incharts_service.pywas not type-aware and directly passed filter values to SQLAlchemy, resulting in invalid SQL likeWHERE total_confirmed = ''.To fix this, the following changes were implemented in
ddpui/core/charts/charts_service.py:_NUMERIC_DATA_TYPESset and_is_numeric_data_typehelper: To identify numeric column types._coerce_filter_valuefunction: This helper now intelligently handles filter values based on their declareddata_type.'') is coerced toNone.intorfloat._build_eq_conditionand_build_neq_condition: These functions generateIS NULLorIS NOT NULLclauses when the coerced value isNone, ensuring correct SQL for null checks.apply_chart_filters: Thedata_typefield from the filter configuration is now read and used to apply the coercion logic before building SQLAlchemyWHEREclauses, preventing the generation of invalid SQL.Fixes DALGO-BACKEND-28K