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

[Explore] New time picker breaks old charts with "x days" in time picker start date #12508

Closed
ktmud opened this issue Jan 14, 2021 · 6 comments · Fixed by #12552
Closed

[Explore] New time picker breaks old charts with "x days" in time picker start date #12508

ktmud opened this issue Jan 14, 2021 · 6 comments · Fixed by #12552
Assignees
Labels
enhancement:committed Enhancement planned / committed by a contributor explore:time Related to the time filters in Explore

Comments

@ktmud
Copy link
Member

ktmud commented Jan 14, 2021

Expected results

In 0.38 and earlier, if you set "30 days" or "5 months" in start date (without "ago", "before", or "last"), it will be automatically converted to the equivalent of "30 days ago". The new time picker will treat it as "30 days after today", causing an Unexpected time range: From date cannot be larger than to date error for some existing charts.

Here are examples of time ranges that will break in the new time picker but are valid for the old one:

  1. "30 days: " -> "30 days ago : now"
  2. "7 days: 7 days" -> "7 days ago : 7 days after today"

Actual results

Existing charts with "x periods" set in start date should behave the same.

Since the original behavior is a little bit ambiguous, we may actually want to force users to use "30 days ago" or "- 30 days" for this use case. So I think it's OK to keep current logic, but to minimize disruption, we should do a db migration to automatically fix such charts and add a breaking change warning in the v1.0 changelog (albeit numbers users who used this syntax is low).

Environment

Latest master

@ktmud ktmud added the #bug Bug report label Jan 14, 2021
@ktmud ktmud added the explore:time Related to the time filters in Explore label Jan 14, 2021
@ktmud
Copy link
Member Author

ktmud commented Jan 14, 2021

Thanks @michellethomas for spotting this issue!

@junlincc junlincc added enhancement:committed Enhancement planned / committed by a contributor and removed #bug Bug report labels Jan 14, 2021
@junlincc
Copy link
Member

thanks for reporting!
we are happy to include the proposed change in patch release, however, we recommend users to implement their own db migration to eliminate the migration risk. lmk if this sounds reasonable. @ktmud

@ktmud
Copy link
Member Author

ktmud commented Jan 14, 2021

I think we should at least add an entry in UPDATING.md to highlight this breaking change. DB migration script is a low priority considering the low volume of such charts, but it should be eventually committed to the Superset codebase because this is not a company-specific bug.

@zhaoyongjie
Copy link
Member

zhaoyongjie commented Jan 14, 2021

I'm thinking maybe we can do some adaptations in get_since_until

def get_since_until(
@ktmud

@ktmud
Copy link
Member Author

ktmud commented Jan 14, 2021

That works too. But I do find the previous behavior too ambiguous and somewhat confusing so would appreciate it if we can properly deprecate it. Maybe even throw an error message when "x periods" are used without the look back/forward descriptors.

@zhaoyongjie
Copy link
Member

This is a good point. When we detect the user time range value is "X [dateunit]" then respond to an error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement:committed Enhancement planned / committed by a contributor explore:time Related to the time filters in Explore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants