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

kapacitor
#1

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"')
        .period(60d)
        .every(1m)
        .align()
        .groupBy(time(1d))

var shifted = base
    |shift(30d)

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

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

// alerting

var trigger = compared
    |alert()
        .id('test1')
        .message('{{ .ID }} is {{ .Level }}: {{ .Fields }}')
        .info(lambda: TRUE)
        .warn(lambda: "change" <= 0.5)
        .crit(lambda: "change" >= 0.5)
        .idTag('alertID')
        .levelTag('level')
        .messageField('message')
        .durationField('duration')

trigger
    |influxDBOut()
        .create()
        .database('chronograf')
        .retentionPolicy('autogen')
        .measurement('alerts')
        .tag('alertName', 'test1')
        .tag('triggerType', 'custom')

// debugging

base
    |influxDBOut()
        .create()
        .database('gts-device-10000001-tick-debug-1')
        .retentionPolicy('autogen')
        .measurement('base')

shifted
    |influxDBOut()
        .create()
        .database('gts-device-10000001-tick-debug-1')
        .retentionPolicy('autogen')
        .measurement('shifted')

joined
    |influxDBOut()
        .create()
        .database('gts-device-10000001-tick-debug-1')
        .retentionPolicy('autogen')
        .measurement('joined')

compared
    |influxDBOut()
        .create()
        .database('gts-device-10000001-tick-debug-1')
        .retentionPolicy('autogen')
        .measurement('compared')

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?

Regards

Niklas