Result is empty when joining a batch with itself (shifted)


Dear community,

the following is my first Tick script, therefore I apologize in advance in case my script is a bit amateurish :-). I tried to join a batch with itself, well with a shifted variant of itself. While the shift works, the join results in an empty set. I currently do not understand why the set is empty, therefore I am reaching out for some help. Looking forward to your ideas and opinions.

Here is the code:

// prepare data

var base = batch
    |query('SELECT mean("durchfluss") AS "value" FROM "gts-device-10000001"."autogen"."sensors.filtration"')

var shifted = base

var joined = shifted
        .as('past', 'current')

var compared = joined
    |eval(lambda: float("current.value" - "past.value") / float("past.value"))

// alerting

var trigger = compared
        .message('{{ .ID }} is {{ .Level }}: {{ .Fields }}')
        .info(lambda: TRUE)
        .warn(lambda: "change" <= 0.5)
        .crit(lambda: "change" >= 0.5)

        .tag('alertName', 'test1')
        .tag('triggerType', 'custom')

// debugging





Here is the corresponding digraph:

digraph test1 {
graph [throughput="0.00 batches/s"];

query1 [avg_exec_time_ns="0s" batches_queried="3" errors="0" points_queried="183" working_cardinality="0" ];
query1 -> influxdb_out8 [processed="3"];
query1 -> shift2 [processed="3"];
query1 -> join4 [processed="3"];

influxdb_out8 [avg_exec_time_ns="20.758┬Ás" errors="0" points_written="183" working_cardinality="0" write_errors="0" ];

shift2 [avg_exec_time_ns="503ns" errors="0" working_cardinality="0" ];
shift2 -> influxdb_out9 [processed="3"];
shift2 -> join4 [processed="3"];

influxdb_out9 [avg_exec_time_ns="138ns" errors="0" points_written="183" working_cardinality="0" write_errors="0" ];

join4 [avg_exec_time_ns="0s" errors="0" working_cardinality="1" ];
join4 -> influxdb_out10 [processed="0"];
join4 -> eval5 [processed="0"];

influxdb_out10 [avg_exec_time_ns="0s" errors="0" points_written="0" working_cardinality="0" write_errors="0" ];

eval5 [avg_exec_time_ns="0s" errors="0" working_cardinality="0" ];
eval5 -> influxdb_out11 [processed="0"];
eval5 -> alert6 [processed="0"];

influxdb_out11 [avg_exec_time_ns="0s" errors="0" points_written="0" working_cardinality="0" write_errors="0" ];

alert6 [alerts_triggered="0" avg_exec_time_ns="0s" crits_triggered="0" errors="0" infos_triggered="0" oks_triggered="0" warns_triggered="0" working_cardinality="0" ];
alert6 -> influxdb_out7 [processed="0"];

influxdb_out7 [avg_exec_time_ns="0s" errors="0" points_written="0" working_cardinality="0" write_errors="0" ];

Any ideas?