With a datepart smaller than day, the datediff in the top was comparing datetime to date (i.e. datetime at the first minute of the day), not selecting enough records for populating the last day.
This update selects enough values in thetop by looking at the next day. Additional values are still filtered out below in the macro, in the "filtered" CTE.
Closing this one. I just read from dbt-utils that the end-date needs to be excluded. I will check the behaviour of date_spine with a datepart of hour in bigquery and compare with the results of this package.
With a
datepart
smaller than day, thedatediff
in thetop
was comparingdatetime
todate
(i.e.datetime
at the first minute of the day), not selecting enough records for populating the last day.This update selects enough values in the
top
by looking at the next day. Additional values are still filtered out below in the macro, in the "filtered" CTE.