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

Consistent date difference level across backends #1838

Open
ADBond opened this issue Jan 12, 2024 · 1 comment
Open

Consistent date difference level across backends #1838

ADBond opened this issue Jan 12, 2024 · 1 comment

Comments

@ADBond
Copy link
Contributor

ADBond commented Jan 12, 2024

Datediff measures boundary partitions, so e.g. '30th Jan to 1st Feb is 1 month, but so is 1st Jan to 28th Feb'. Currently there is discrepancy across backends in DatediffLevel which do things like this (duckdb), and those which treat year/month as 'time intervals' (spark, postgres).

Arguably the 'boundary partition' approach is not that useful compared to 'fixed intervals', which is perhaps more intuitive.

Proposal is to replace DatediffLevel with a DateDifferenceLevel (changing name to make it clear this does not align with 'datediff' semantics), which behaves consistently across backends, and essentially has 1 year == 12 months == 30 days (modulo some details on those specific numbers). True datediff behaviour using boundary partitions will still be available using custom SQL for any users that may still require this.

@RobinL
Copy link
Member

RobinL commented Jan 16, 2024

Yep - fully support this, and should make the implementation simpler as well!

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

No branches or pull requests

2 participants