Joining two measurements with diferent sample frequencies

Hello,

I’m trying to solve se following problem:

There is a measurement with the sample time of 30 seconds (Measurement 1), and there is a measurement with the sample time of 2 miliseconds (Measurement 2).

I need to join this two streams together (in a tick script) to produce the output as in the figure. The Measurement 1 must be oversampled/repeated every time a point from Measurement 2 arrives.

I tried the following tick script:

var features = stream
    |from()
        .measurement('stdk_teste')

var models = stream
    |from()
        .measurement('trained_model')

var data = features
    |join(models)
    	.tolerance(100ms)
    |influxDBOut()
        .database('testes_canonicos')
        .measurement('joins')

But it is producing an output that is not what i want:


(Note the timestamps, they are 30s spaced, all the data that arrives every 2ms is getting lost)

Thanks,
Vittor