jenwitteng opened a new issue, #37114:
URL: https://github.com/apache/superset/issues/37114
### Bug description
Step to Reproduce.
1. Enable Async Query
2. Define Metrics in chart with custom sql that have \r\n(new line) or jinja
template superset did order by <Metrics>
3. Open Dashboard with that chart
Investigation
1. Cache key on writing and reading got different..
2. Check value before hashing to cache key found that
**orderby.sqlExpression** got different.
2.1 case \r\n writing cache still have \r\n but reading cache got change to
\n so generate different cache key.
2.2 case jinja template
writing cache
> 'sqlExpression': "{% set no_of_mrs = filter_values('percentile')[0]
%}\n\nAPPROXIMATE_PERCENTILE((office_hour_mltc/(60*9)) USING PARAMETERS
percentile={{ no_of_mrs }}/100)"}
reading cache
> 'sqlExpression':
'\n\nAPPROXIMATE_PERCENTILE((office_hour_mltc/(60*9)) USING PARAMETERS
percentile=75/100)'}
so it generate different cache key.
Workaround
manual add sort by count(*) or 1
not sure why it alway added order by <Metrics> as default.
### Screenshots/recordings
<img width="2685" height="1288" alt="Image"
src="https://github.com/user-attachments/assets/33e5d4c4-e59d-493d-a565-cbf7d7ca8ccf"
/>
### Superset version
5.0.0
### Python version
3.9
### Node version
16
### Browser
Chrome
### Additional context
_No response_
### Checklist
- [ ] I have searched Superset docs and Slack and didn't find a solution to
my problem.
- [ ] I have searched the GitHub issue tracker and didn't find a similar bug
report.
- [ ] I have checked Superset's logs for errors and if I found a relevant
Python stacktrace, I included it here as text in the "additional context"
section.
--
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]