Closed radeusgd closed 1 month ago
Possible solutions:
Month
date period is used in date_diff
in Snowflake and tell them that the results will be inconsistent with in-memory or some other DBs. Then the user can choose to perform the computation in-memory, or acknowledge the inconsistency.
MONTHS_BETWEEN
https://docs.snowflake.com/en/sql-reference/functions/months_betweenIn either backend our
date_diff
operation delegates to SQLDATE_DIFF
/DATEDIFF
.However, the two backends have differing semantics in some edge cases.
See parts of the test
"should allow computing a SQL-like difference"
:In the Snowflake backend this yields
1
instead of0
.That is because, as documented, when computing a
month
difference, only year and month fields are considered - so the DB sees that the month differs and returns 1, disregarding the day field that shows us that not a full month passed yet.In Snowflake we can check that even:
which compares two dates just 1 day apart, still yields a 1 month difference if asked for months.