Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres: Charts with INTERVAL metrics fail to render #30052

Open
3 tasks done
giftig opened this issue Aug 29, 2024 · 1 comment
Open
3 tasks done

Postgres: Charts with INTERVAL metrics fail to render #30052

giftig opened this issue Aug 29, 2024 · 1 comment
Labels
data:connect:postgres Related to Postgres viz:charts Namespace | Anything related to viz types

Comments

@giftig
Copy link
Contributor

giftig commented Aug 29, 2024

Bug description

When using an INTERVAL type in postgres as a metric, both bar charts and pie charts fail to render with no obvious errors.

For a pie chart, the legend is rendered but nothing else. For a bar chart, the axes and X-axis labels are rendered, but the bars are not drawn.

No errors are reported, either via toast, in the browser console, or in the application logs.

How to reproduce the bug

  1. Write a query against postgres with an INTERVAL column in the response
  2. Create a bar chart or pie chart from that query
  3. Use the INTERVAL as a metric, e.g. with MAX aggregation
  4. Press the button to render the chart

Screenshots/recordings

screenshot_2024-08-29_14-00-05_07894c8a
screenshot_2024-08-29_14-00-49_34811ac2

Superset version

4.0.2

Python version

3.9

Node version

16

Browser

Firefox

Additional context

Rendering the exact same chart but modifying the query to convert the INTERVAL into an integer number of milliseconds worked fine.

Note I also couldn't work around it in this way from the chart itself, as I'd need my metric to be EXTRACT('epoch' FROM total_playtime) which the chart disallowed as it contains a subquery; I had to modify the virtual dataset to work around this.

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.
@dosubot dosubot bot added data:connect:postgres Related to Postgres viz:charts Namespace | Anything related to viz types labels Aug 29, 2024
@giftig
Copy link
Contributor Author

giftig commented Oct 26, 2024

Note that I've also noticed the INTERVAL type doesn't get sorted correctly in query results in SQL Lab; results just end up sorted alphabetically according to the rendered text. It seems there's just no support for INTERVAL in the engine spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:connect:postgres Related to Postgres viz:charts Namespace | Anything related to viz types
Projects
None yet
Development

No branches or pull requests

1 participant