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

superset sqllab and charts complain about pandas timestamp conversion when the dates exceed pandas timestamp bounds #18871

Closed
2 of 3 tasks
yeachan153 opened this issue Feb 23, 2022 · 6 comments · Fixed by #18873
Labels
#bug Bug report explore:time Related to the time filters in Explore explore Namespace | Anything related to Explore inactive Inactive for >= 30 days sqllab:editor sqllab Namespace | Anything related to the SQL Lab

Comments

@yeachan153
Copy link
Contributor

yeachan153 commented Feb 23, 2022

Similar to 13661, 18596, 16487 timestamps older than 1677-09-22 00:12:43.145225 and newer than 2262-04-11 23:47:16.854775807 cannot be converted into pandas timestamp.

By the same logic, charts which create a DTTM_ALIAS column in the backend query also cannot contain dates older than the range mentioned above, and trigger the same failure. They are coerced as NaNs, so that the data for dates within the range pandas supports can at least be shown without triggering the same error.

How to reproduce the bug

Sqllab

  1. Go to 'Sql Lab'
  2. Click on 'Sql Editor'
  3. Try select TIMESTAMP '2263-02-02 00:00:00' (this won't work)
  4. Try select TIMESTAMP '2262-02-02 00:00:00' (this will work since it's inside the range pandas can support)

Charts

  1. Go to 'Charts'
  2. Select time series chart
  3. In the time column, add the date column which has dates outside the ranges mentioned above
  4. Fill in whatever metrics you want to visualise

Expected results

Returns the result correctly.

Actual results

Sqllab:

Casting from timestamp[us] to timestamp[ns] would result in out of bounds timestamp: 9248947200000000

Charts:

Out of bounds nanosecond timestamp: 9999-01-01 00:00:00

Environment

  • browser type and version: chrome
  • superset version: latest & 1.4.1
  • python version: 3.8.12
  • postgres version: 13.4

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.

There are some similar issues, but reviewer mentioned to open a new issue as the PR for the issue was already closed: #14006

@yeachan153 yeachan153 added the #bug Bug report label Feb 23, 2022
@yeachan153 yeachan153 changed the title fix: casting from timestamp[us] to timestamp[ns] would result in out of bounds timestamp superset sqllab and charts complain about pandas timestamp conversion when the dates are out of bounds Feb 23, 2022
@villebro
Copy link
Member

Out of curiosity, is this a theoretical problem or do you have a real need for timestamps that far in the future/history?

@villebro villebro added explore:time Related to the time filters in Explore explore Namespace | Anything related to Explore sqllab Namespace | Anything related to the SQL Lab sqllab:editor labels Feb 23, 2022
@yeachan153
Copy link
Contributor Author

yeachan153 commented Feb 23, 2022

Hi @villebro, for us we have databases upstream who mark some timestamps as 9999-12-31T00:00:00 to indicate that this data point has not expired/is current.. Not ideal but it's not possible for us downstream to change that

@yeachan153 yeachan153 changed the title superset sqllab and charts complain about pandas timestamp conversion when the dates are out of bounds superset sqllab and charts complain about pandas timestamp conversion when the dates exceed pandas timestamp bounds Feb 23, 2022
@villebro
Copy link
Member

Actually, after I wrote that, it hit me that I used to use 9999-12-31 to indicate active rows on an SCD on an Oracle database back in the day. So I agree, this is a real issue 🙂

@stale
Copy link

stale bot commented Apr 29, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label Apr 29, 2022
@cjaiello
Copy link

Is there still no fix for this?

@yeachan153
Copy link
Contributor Author

Is there still no fix for this?

Can you try with version 1.5.1 or higher?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
#bug Bug report explore:time Related to the time filters in Explore explore Namespace | Anything related to Explore inactive Inactive for >= 30 days sqllab:editor sqllab Namespace | Anything related to the SQL Lab
Projects
None yet
3 participants