You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "sadpandajoe (via GitHub)" <gi...@apache.org> on 2023/12/18 17:23:20 UTC
[I] Alerts aren't firing with error 'Alert query returned a non-number value.' when returning a date column [superset]
sadpandajoe opened a new issue, #26298:
URL: https://github.com/apache/superset/issues/26298
A clear and concise description of what the bug is.
#### How to reproduce the bug
1. Create an alert
2. Use the examples database
3. Use this query: `SELECT year FROM main.wb_health_population LIMIT 1`
4. Set the condition as `!=`
5. Set the value a `0`
6. Finish filling out the rest of the alert form
### Expected results
The alert is sent because the condition is met
### Actual results
Send error with `Alert query returned a non-number value.`
#### Screenshots
If applicable, add screenshots to help explain your problem.
### Environment
(please complete the following information):
- browser type and version:
- superset version: `superset version`
- python version: `python --version`
- node.js version: `node -v`
- any feature flags active:
### Checklist
Make sure to follow these steps before submitting your issue - thank you!
- [ ] I have checked the superset logs for python stacktraces and included it here as text if there are any.
- [ ] I have reproduced the issue with at least the latest released version of superset.
- [ ] I have checked the issue tracker for the same issue and I haven't found one similar.
### Additional context
Looks like the first failure was with this SHA `2ac28927a326fee6431b5e01f7930e650c636c17`
--
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: notifications-unsubscribe@superset.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Alerts aren't firing with error 'Alert query returned a non-number value.' when returning a date column [superset]
Posted by "john-bodley (via GitHub)" <gi...@apache.org>.
john-bodley commented on issue #26298:
URL: https://github.com/apache/superset/issues/26298#issuecomment-1861844804
For context [here's](https://github.com/apache/superset/blob/596f5569be34409ca11b02c442424152fbf4a3e2/superset/commands/report/alert.py#L118-L119) the line where @sadpandajoe's error was coming from. The Python [`float()`](https://www.w3schools.com/python/ref_func_float.asp) method will try to convert any type into a float and will throw an exception otherwise:
```python
>>> float('2023')
2023.0
>>> float('2023-12-01')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: could not convert string to float: '2023-12-01'
>>>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Alerts aren't firing with error 'Alert query returned a non-number value.' when returning a date column [superset]
Posted by "john-bodley (via GitHub)" <gi...@apache.org>.
john-bodley commented on issue #26298:
URL: https://github.com/apache/superset/issues/26298#issuecomment-1861644976
Per [here](https://github.com/apache/superset/blob/04f1c356a51464b49236c0dff379d71cd9a6cd4e/superset/examples/world_bank.py#L74) it seems like `year` is a `DATETIME` column and thus shouldn't the specified alert query,
```sql
SELECT year FROM main.wb_health_population LIMIT 1
```
be (assuming SQLite):
```sql
SELECT CAST(strftime('%Y', year) AS INT) FROM main.wb_health_population LIMIT 1
```
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Alerts aren't firing with error 'Alert query returned a non-number value.' when returning a date column [superset]
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on issue #26298:
URL: https://github.com/apache/superset/issues/26298#issuecomment-1861586679
> This was working beforehand with a single digit so if we need double precision, it could potentially break for other people who don't currently have it.
@sadpandajoe I believe the error is not related to the double precision but to the fact that the query is returning a non-numeric value.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Alerts aren't firing with error 'Alert query returned a non-number value.' when returning a date column [superset]
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina closed issue #26298: Alerts aren't firing with error 'Alert query returned a non-number value.' when returning a date column
URL: https://github.com/apache/superset/issues/26298
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Alerts aren't firing with error 'Alert query returned a non-number value.' when returning a date column [superset]
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on issue #26298:
URL: https://github.com/apache/superset/issues/26298#issuecomment-1861572881
@sadpandajoe @eschutho @betodealmeida @john-bodley
Given that the threshold needs to be a double precision number, do the query always need to return a numeric value?
<img width="490" alt="Screenshot 2023-12-18 at 17 30 24" src="https://github.com/apache/superset/assets/70410625/59ec7e12-1545-4743-a95a-45737ad838dc">
If that's the case, are we missing a tooltip explaining this constraint? I'm assuming the execution log will show the error.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Alerts aren't firing with error 'Alert query returned a non-number value.' when returning a date column [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on issue #26298:
URL: https://github.com/apache/superset/issues/26298#issuecomment-1863170144
@john-bodley yeah and if you do an alert based on that and in the successful logs you get `-315619200000000000` as a return value which will trigger the alert. So either it's been an existing bug within alerts and reports that just worked or it's a breaking change and we should at least put it in the breaking change log so if people do upgrade it won't break their alerts.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Alerts aren't firing with error 'Alert query returned a non-number value.' when returning a date column [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on issue #26298:
URL: https://github.com/apache/superset/issues/26298#issuecomment-1861582298
This was working beforehand with a single digit so if we need double precision, it could potentially break for other people who don't currently have it.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Alerts aren't firing with error 'Alert query returned a non-number value.' when returning a date column [superset]
Posted by "john-bodley (via GitHub)" <gi...@apache.org>.
john-bodley commented on issue #26298:
URL: https://github.com/apache/superset/issues/26298#issuecomment-1862002303
I've also been able to repro the behavior—which seems correct—on 3.0.2:
```
> git checkout 3.0.2
Updating files: 100% (1401/1401), done.
Note: switching to '3.0.2'.
...
HEAD is now at 961eba6d97 chore: Updates CHANGELOG.md for 3.0.2 (rc2)
> rm -rf examples.db
> python3.9 -m pip install -e .
> FLASK_DEBUG=true superset load-examples
> FLASK_DEBUG=true superset run --port 8088
> sqlite3 examples.db
SQLite version 3.41.1 2023-03-10 12:13:52
Enter ".help" for usage hints.
sqlite> .schema wb_health_population
CREATE TABLE wb_health_population (
country_name VARCHAR(255),
country_code VARCHAR(3),
region VARCHAR(255),
year DATETIME
);
```
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Alerts aren't firing with error 'Alert query returned a non-number value.' when returning a date column [superset]
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on issue #26298:
URL: https://github.com/apache/superset/issues/26298#issuecomment-1862795389
Reading the comments it seems this is not a bug but an expected error when the query returns something that is not numeric. It seems the only follow up could be adding a tooltip to the SQL input to make this restriction more clear as I suggested [here](https://github.com/apache/superset/issues/26298#issuecomment-1861572881).
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Alerts aren't firing with error 'Alert query returned a non-number value.' when returning a date column [superset]
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on issue #26298:
URL: https://github.com/apache/superset/issues/26298#issuecomment-1863217925
> or it's a breaking change and we should at least put it in the breaking change log so if people do upgrade it won't break their alerts.
@sadpandajoe I personally don't view this as a breaking change but more like a fix. Previously, if someone had a query that didn't return a numeric value, the application was wrongfully converting the return value and firing alerts under a incorrect condition evaluation. What the behavior should be is the current one, where errors are thrown when the condition cannot be evaluated. Right now, there are alerts that are being fired under false pretenses and they should stop working, or in other words, they should break.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Alerts aren't firing with error 'Alert query returned a non-number value.' when returning a date column [superset]
Posted by "john-bodley (via GitHub)" <gi...@apache.org>.
john-bodley commented on issue #26298:
URL: https://github.com/apache/superset/issues/26298#issuecomment-1861978437
@eschutho and @sadpandajoe are we sure this is a regression as I'm able to repro this using version `12.0.0` of `pyarrow`?
Additionally, per https://github.com/apache/superset/issues/26298#issuecomment-1861644976, it seems like the `year` column is a `DATETIME` rather than an `INT`:
<img width="1440" alt="Screenshot 2023-12-19 at 2 55 45 PM" src="https://github.com/apache/superset/assets/4567245/efe88731-d8d2-49fc-9c2b-451b7003ec70">
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Alerts aren't firing with error 'Alert query returned a non-number value.' when returning a date column [superset]
Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho commented on issue #26298:
URL: https://github.com/apache/superset/issues/26298#issuecomment-1861821702
@sadpandajoe found that this is a regression from https://github.com/apache/superset/pull/26187. We bumped Pyarrow from 12.x to 14.x and there was a breaking change that impacts the value of year from an into to a timestamp, thus breaking existing alerts if you were (probably incorrectly) returning the year as an int. If we want to maintain our own backward compatibility, we could cast it back to an int automatically. I'm not sure all of the places where this change has impacted the codebase other than alerts, or if we want to consider this a bug fix rather than a breaking change. Thoughts?
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org