Flux function fill() with influxdb 1.7.6

I just updated my Influxdb to the latest 1.7.6 version (flux v0.24) and wonderd that the fill() function is not showing up in the FLUX FUNCTIONS dropdown. The does not throw any Error, it just simply does not do anything.

from(bucket: "Export/autogen")  
|> range(start: 2019-00-00T00:00:00Z)  
|> filter(fn: (r) =>
      r._measurement == "Data" and
      r._field == "Value" and
      r.TagId == "23846"
    )   
|> fill(column: "_value", usePrevious: true)
|> yield()

It also does nothing when trying to change the fill() function to just

|> fill(usePrevious: true)

In https://community.influxdata.com/t/flux-fill-function-with-influxdb-1-x/9387 a staff member said that in v1.7.6 the fill function will be available again.

Is there any major mistake inmy code or ist there just a bug?

Hi @Froonsoi, one of our engineers built 1.7.6 from source and fill worked for him. Have you tried using it with this syntax to see what happens?

from(bucket: "telegraf/autogen") |> range(start:-10m) |> filter(fn: (r) => r._measurement == "cpu") |> fill(value: 1.4)

Hi, thanks for the reply.
I tried your syntax but it didn’t work.
It just ignores the fill function, but it catches if there is an error in it.

When I use the InfluxQL with the Query:

SELECT mean("Value") AS "mean_Value" FROM "Export"."autogen"."Data" WHERE time > :dashboardTime: AND "TagId"='23846' GROUP BY time(1m) FILL(previous)

I get my expected behavior.

With Flux:

A = from(bucket: "Export/autogen")  
|> range(start: 2019-01-01)  
|> filter(fn: (r) =>
      r._measurement == "Data" and
      r._field == "Value" and
      r.TagId == "23846"
    )   
  
|> fill(value: 12.0)
|> yield()

It get this:

Any Idea?
Thanks.

Just to cover all our bases, can you run curl -sL -I localhost:8086/ping to check your version number?

There are two things that I’m noticing in your InfluxQL query that are different from your Flux query: you’re using mean and you’re grouping by time. Could that be causing the difference?

Curling gives me following result:

curl

I see your point. I tried to get as close to the InfluxQL Query but mean() and Group by() didnt make a difference

Ok, so i’m very new but also had problems with fill() not wroking.
for some reason this works

from(bucket: "openhab_db")
  |> range(start: -2y, stop: -1y)
  |> filter(fn: (r) => r._measurement == "G_Temperature_wn8_pool" and r._field == "value")
  |> aggregateWindow(every: 3d, fn: mean)
  |> fill(usePrevious: true)  

but this one will come back with a hole in the results:

from(bucket: "openhab_db")
  |> range(start: -2y, stop: -1y)
  |> filter(fn: (r) => r._measurement == "G_Temperature_wn8_pool" and r._field == "value")
  |> fill(usePrevious: true)  
  |> aggregateWindow(every: 3d, fn: mean)

Notice the order when the fill is used

Hi @Maciej_Eckstein, fill(usePrevious: true) will fail if there is a nil value being used as the fill value, and flux will have problems with a calculation that has nil values. The order of fill matters, and you may also have to add a fill with a default value.

@Froonsoi, does removing the mean and groupby from your InfluxQL query yield the same result as your Flux query?

@Sonia_Gupta, yes. I get the exact same query.

I do not exactly understand yourpoint. If you could explain it a bit more.
My pool temp measument has no values in the DB for a about a week. So both query with aggregateWindow(every: 3d, fn: mean) and without has null datapoints. Then fill() should behave similar. However it does not. Same query in th IQL is flawless but there you dont have and issue of order.

@Froonsoi Do you get the expected result which looks like the top graph?

Hello @Maciej_Eckstein,
Can you please share your input and expected output data? In line protocol? Aggregate window can create additional null values which can help explain why order matters. For example if I run

from(bucket: "telegraf/autogen") 
|> range(start:-24h) 
|> filter(fn: (r) => r._measurement == "cpu" 
and r._field == "usage_user" and r.cpu == "cpu-total")

I don’t have any null values so

fill(usePrevious:true)

doesn’t have any effect if I use it immediately after. However now if I do

from(bucket: "telegraf/autogen") 
|> range(start:-24h) 
|> filter(fn: (r) => r._measurement == "cpu" 
and r._field == "usage_user" and r.cpu == "cpu-total") 
|> aggregateWindow(every: 1h, fn: mean)

I’m asking influx to generate a point for usage_user when telegraf wasn’t running and I wasn’t collecting any data, so it will create a null values (probably when I was sleeping and my computer was off). Now if I use fill() it will have an effect.

Hey @Froonsoi. Fill works for me when I do a similar query. Is it possible there are no null values to fill for?

Ok that makes sense. The order is important in Flux becouse the null points are accualy introduced by the agregateWindow(). In my case I had no mesurments for a week. so with the window of 1d or 3d I made null points this way. Fill needs to be next and that works fine.
Some major change of thinking is required to use flux.

@Sonia_Gupta, well no, I get the false result (bottom picture)

@katy, in the Database there are only rising edges of changes. So there is plenty of space which should be filles with values.