Join over a null query result

Hey there!

I continue working on a workaround for this problem.

I found a way to bypass that issue, by putting the timestamp as the point timestamp (as they are in different measurements and same time points on the same measurement will have different tags, it should be ok).

My issue now is the following: I’m doing three different batch queries (on the same period and with the same every()), but one of them sometimes returns no value (it’s a count, when there is no entries it just return nothing instead of a zero - issue here).

My script is something like this:

var views = batch
    |query('SELECT count("sessionID") as "count" FROM "DB_staging"."autogen"."Measurement1"')
        .period(1h)
        .every(15s)
        .fill(0)
        .align()

var actions = batch
    |query('SELECT count("sessionID") as "count" FROM "DB_staging"."autogen"."Measurement2"')
        .period(1h)
        .every(15s)
        .fill(0)
        .align()

batch
    |query('SELECT count("sessionID") as "count" FROM "DB_staging"."autogen"."Measurement3"')
        .period(1h)
        .every(15s)
        .fill(0)
        .align()
    |log()
    |join(views, actions)
      .as('searches', 'views', 'actions')
      .tolerance(1h)
      .fill(0)
      .streamName('ConsolidatedData')
    |eval(lambda: "actions.count",
          lambda: "views.count",
          lambda: "searches.count")
        .as('actions',
            'views',
            'searches')
    |log()
    |influxDBOut()
        .database('DB_staging')
        .measurement('ConsolidatedData')

The point in that script is that actions sometimes returns nothing, so the join doesn’t execute. However, when I save a new script on telegraf it executes all pending joins (one per null batch since last save) at once, which is kinda weird :frowning:

Is there anything I can do to solve this?

I have tries returning all sessionID and then do a count() on Kapacitor with no luck at all