FrancescoCastaldi opened a new pull request, #45822: URL: https://github.com/apache/superset/pull/45822
### SUMMARY Fixes #45459. When a temporal filter carries an unparseable time range (such as `"a : b"` or inverted date bounds like `"2024-02-01 : 2024-01-01"`), `get_since_until_from_time_range` raises `TimeRangeParseFailError` (subclass of marshmallow `ValidationError`) or `ValueError`. When such an invalid time range is present in a secondary temporal filter or during date-range timeshift processing: - In `get_sqla_query`, the parse failure was uncaught and escaped the query validation handlers, reaching the global Flask error handler and returning HTTP 500 instead of HTTP 400. - In `processing_time_offsets`, relative and date-range offsets experienced similar uncaught parse errors. This change: 1. Catches `(TimeRangeParseFailError, TimeRangeAmbiguousError, ValidationError, ValueError)` across `get_sqla_query` and `processing_time_offsets`. 2. Converts the error into `QueryObjectValidationError` naming the invalid column, enabling `QueryContextProcessor` to return an informative 400 Bad Request. 3. Adds comprehensive unit tests in `tests/unit_tests/models/helpers_test.py`. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A (Backend API error handling) ### TESTING INSTRUCTIONS Run unit tests: ```bash pytest tests/unit_tests/models/helpers_test.py ``` ### ADDITIONAL INFORMATION - [x] Has associated issue: Fixes #45459 - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in SIP-59) - [ ] Introduces new feature or API - [ ] Removes existing feature or API -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
