gabotorresruiz opened a new pull request, #35871: URL: https://github.com/apache/superset/pull/35871
<!--- Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/ Example: fix(dashboard): load charts correctly --> ### SUMMARY <!--- Describe the change below, including rationale and design decisions --> Alerts configured with operator validators (>, <, >=, <=, !=) were silently defaulting to a value of `0.0` when their custom SQL queries returned no results. This behavior could cause alerts to trigger incorrectly, as the system would evaluate the threshold condition against this default value instead of recognizing that the query produced no data. This change addresses the issue by raising an explicit AlertQueryError when operator validator queries return empty results. Instead of silently defaulting to 0.0, the system now logs detailed diagnostic information (including the report_schedule_id, execution_id, and the query itself) and presents users with a clear, actionable error message ### TESTING INSTRUCTIONS <!--- Required! What steps can be taken to manually verify the changes? --> 1. Create a test alert: - Go to Alerts & Reports --> Create Alert - Select a database and configure a query that returns no results: `SELECT value FROM some_table WHERE 1 = 0` - Set validator type to OPERATOR (e.g., >) - Set threshold to any value (e.g., 10) - Save the alert 2. Trigger the alert: - Manually trigger the alert or wait for scheduled execution 3. Verify the error: - Alert should fail with error message: "Alert query returned no results. Please verify your query is correct and returns data." - Check logs for detailed error with report_schedule_id and query details - Verify alert does not trigger incorrectly ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] 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]
