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

Add origin parameter to time_bucket_gapfill #5485

Closed
wants to merge 1 commit into from

Conversation

syvb
Copy link
Member

@syvb syvb commented Mar 25, 2023

Allows specifying an origin for time_bucket_gapfill.

I added the origin parameter after start/finish since adding it before would make calls with a third argument ambiguous – it could refer to either the start or origin: with time_bucket_gapfill(..., ..., '2022-01-01') the last argument could refer to start or origin. The API I defined in this I added a optional origin argument at the end, after start/finish. Normally users should specify as a named argument. This makes the API somewhat inconsistent, since timezone is before the start/finish.

This change has to be a modification of the existing function, since origin is after the start/finish arguments which default to NULL, and all arguments after an argument with a default must also have defaults. Changing the function means that upgrades require dropping it and recreating it, which would break existing views that rely on time_bucket_gapfill. We could work around this by renaming the old functions (to something like _timescaledb_internal.time_bucket_gapfill_old) so that existing views don't break.

Other API options:

  • Creating a new time_bucket_gapfill_ng function
  • Making the origin argument the first argument so there wouldn't be any ambiguity

I still need to add some tests and update the update/downgrade scripts.

cc @davidkohn88
Partially addresses #3212.

@syvb syvb closed this Apr 5, 2023
@LoganSurmount
Copy link

LoganSurmount commented Apr 5, 2023 via email

@syvb
Copy link
Member Author

syvb commented Apr 5, 2023

@LoganSurmount You're watching this repo so you get notifications for everything – you can unwatch it at https://github.com/timescale/timescaledb
arrow pointing to unwatch button

@MichaelSaucier
Copy link

Hello! Does this fix 1304 as well?
#1304

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants