Kapacitor - Union of shifted metrics missing points from most nodes

I’m trying to shift metrics forward in time to visualize the data from last week, 2 weeks ago, etc

I’m attempting to do this by assigning each shift duration’s pipeline (shift() from the BatchNode then eval() to rename the fields), then taking the union of all of those and write them out:

dbrp "dashboards"."statistics"

var now = batch|query('
      SELECT
      "count",
      "duration"
      FROM "dashboards"."statistics"."overall_tp90"
    ')
        .period(30m)
        .every(1m)
        .groupBy('country')
        .align()
        .alignGroup()

var w1 = now|shift(1w)|eval(lambda:"duration", lambda:"count").as('count-1w', 'duration-1w')
var w2 = now|shift(2w)|eval(lambda:"duration", lambda:"count").as('count-2w', 'duration-2w')
var w3 = now|shift(3w)|eval(lambda:"duration", lambda:"count").as('count-3w', 'duration-3w')
var w4 = now|shift(4w)|eval(lambda:"duration", lambda:"count").as('count-4w', 'duration-4w')
var w5 = now|shift(5w)|eval(lambda:"duration", lambda:"count").as('count-5w', 'duration-5w')
var w6 = now|shift(6w)|eval(lambda:"duration", lambda:"count").as('count-6w', 'duration-6w')
var w7 = now|shift(7w)|eval(lambda:"duration", lambda:"count").as('count-7w', 'duration-7w')
var w8 = now|shift(8w)|eval(lambda:"duration", lambda:"count").as('count-8w', 'duration-8w')

now|union(w1, w2, w3, w4, w5, w6, w7, w8)
    |InfluxDBOut()
    .database('dashboard_timeshift_test')
    .retentionPolicy('statistics')
    .measurement('overall_tp90')

This seems to run successfully but I seem to only get data from the ‘now’ node in influx:

> show field keys
name: overall_tp90
fieldKey fieldType
-------- ---------
count    float
duration float

If i instead do ‘w1|union(w2, w3, …)’, I only get data from the w1 node:

> show field keys
name: overall_tp90
fieldKey    fieldType
--------    ---------
count-1w    float
duration-1w float

Here’s the output from a ‘show’ on the task:

DOT:
digraph overall_tp90_timeshift {
graph [throughput="0.00 batches/s"];

query1 [avg_exec_time_ns="0s" batches_queried="2166" errors="0" points_queried="39003" working_cardinality="0" ];
query1 -> shift16 [processed="2166"];
query1 -> shift14 [processed="2166"];
query1 -> shift12 [processed="2166"];
query1 -> shift10 [processed="2166"];
query1 -> shift8 [processed="2166"];
query1 -> shift6 [processed="2166"];
query1 -> shift4 [processed="2166"];
query1 -> shift2 [processed="2166"];
query1 -> union26 [processed="2166"];

shift16 [avg_exec_time_ns="0s" errors="0" working_cardinality="0" ];
shift16 -> eval17 [processed="2166"];

eval17 [avg_exec_time_ns="0s" errors="0" working_cardinality="186" ];
eval17 -> union26 [processed="2166"];

shift14 [avg_exec_time_ns="0s" errors="0" working_cardinality="0" ];
shift14 -> eval15 [processed="2166"];

eval15 [avg_exec_time_ns="0s" errors="0" working_cardinality="186" ];
eval15 -> union26 [processed="2166"];

shift12 [avg_exec_time_ns="0s" errors="0" working_cardinality="0" ];
shift12 -> eval13 [processed="2166"];

eval13 [avg_exec_time_ns="0s" errors="0" working_cardinality="186" ];
eval13 -> union26 [processed="2166"];

shift10 [avg_exec_time_ns="0s" errors="0" working_cardinality="0" ];
shift10 -> eval11 [processed="2166"];

eval11 [avg_exec_time_ns="0s" errors="0" working_cardinality="186" ];
eval11 -> union26 [processed="2166"];

shift8 [avg_exec_time_ns="0s" errors="0" working_cardinality="0" ];
shift8 -> eval9 [processed="2166"];

eval9 [avg_exec_time_ns="0s" errors="0" working_cardinality="186" ];
eval9 -> union26 [processed="2166"];

shift6 [avg_exec_time_ns="0s" errors="0" working_cardinality="0" ];
shift6 -> eval7 [processed="2166"];

eval7 [avg_exec_time_ns="0s" errors="0" working_cardinality="186" ];
eval7 -> union26 [processed="2166"];

shift4 [avg_exec_time_ns="0s" errors="0" working_cardinality="0" ];
shift4 -> eval5 [processed="2166"];

eval5 [avg_exec_time_ns="0s" errors="0" working_cardinality="186" ];
eval5 -> union26 [processed="2166"];

shift2 [avg_exec_time_ns="0s" errors="0" working_cardinality="0" ];
shift2 -> eval3 [processed="2166"];

eval3 [avg_exec_time_ns="0s" errors="0" working_cardinality="186" ];
eval3 -> union26 [processed="2166"];

union26 [avg_exec_time_ns="0s" errors="0" working_cardinality="0" ];
union26 -> influxdb_out27 [processed="2166"];

influxdb_out27 [avg_exec_time_ns="0s" errors="0" points_written="39003" working_cardinality="0" write_errors="0" ];
}

Am I missing something about how node variables and pipelines work? Why doesn’t the union appear to be doing anything?