increment snapshot period

This commit is contained in:
Paul Trowbridge 2021-07-30 08:15:48 -04:00
parent c48e52f95c
commit b2147b0a02
2 changed files with 4 additions and 4 deletions

View File

@ -21,7 +21,7 @@ tdr AS (
DATERANGE('2021-06-01','2022-06-01','[)') prange DATERANGE('2021-06-01','2022-06-01','[)') prange
-----------explicitly call out overlap period------------------------ -----------explicitly call out overlap period------------------------
-----------anythign in this period has to net out to match actuals--- -----------anythign in this period has to net out to match actuals---
,DATERANGE('2021-06-01','2021-07-12','[]') overlap ,DATERANGE('2021-06-01','2021-07-29','[]') overlap
,jsonb_build_array('plan','diff') iter ,jsonb_build_array('plan','diff') iter
) )
,booked AS materialized( ,booked AS materialized(

View File

@ -16,19 +16,19 @@ DROP TABLE IF EXISTS tdr;
CREATE TEMP TABLE tdr AS ( CREATE TEMP TABLE tdr AS (
SELECT SELECT
-----------actuals into baseline------------------------------------- -----------actuals into baseline-------------------------------------
DATERANGE('2020-06-01','2021-07-15','[]') arange DATERANGE('2020-06-01','2021-07-29','[]') arange
-----------plan into baseline---------------------------------------- -----------plan into baseline----------------------------------------
,DATERANGE('2020-06-01','2022-06-01','[)') prange ,DATERANGE('2020-06-01','2022-06-01','[)') prange
-----------forecast into baseline------------------------------------ -----------forecast into baseline------------------------------------
,DATERANGE('2022-06-01','2022-06-01','[)') frange -- this range effectively excludes ,DATERANGE('2022-06-01','2022-06-01','[)') frange -- this range effectively excludes
-----------baseline selection for increment-------------------------- -----------baseline selection for increment--------------------------
,DATERANGE('2021-07-15','2021-07-15','[)') selection ,DATERANGE('2021-07-29','2021-07-29','[)') selection
-----------selection increment size---------------------------------- -----------selection increment size----------------------------------
,'0 year'::interval AS incr ,'0 year'::interval AS incr
-----------iterations to merge with---------------------------------- -----------iterations to merge with----------------------------------
,(SELECT jsonb_agg(x.v) FROM (VALUES('copy'),('actuals'),('actuals_plug')) AS x(v)) iter ,(SELECT jsonb_agg(x.v) FROM (VALUES('copy'),('actuals'),('actuals_plug')) AS x(v)) iter
-----------existing baseline overlap--------------------------------- -----------existing baseline overlap---------------------------------
,DATERANGE('2000-06-01','2021-07-08') overlap ,DATERANGE('2000-06-01','2021-07-29') overlap
); );
--select * from tdr --select * from tdr