hi
i am unable to fathom the issue in below query//
keeping on getting ther below error
** ** runtime error @10:5-16:4: reduce: type conflict: int != float** **
basically from my bucket i am selecting the fields with “Fail” in the name of field…
i convert them to float using map …
post which i want to group on time( i have all the data for 2 time stamps 15 minutes apart only) and calculate the change in the value of last time stamped to first time stamp and finally want to filter all those fields where there is more than 100 percent failure increase or aboslute incerase by 50 or more…
will appreciate the help to get me past this
thnks
rajib
from(bucket: “perfcounter4g”)
|> range(start: -30d)
|> filter(fn: (r) => r["_field"] =~/Fail/)
|> map(fn: (r) => ({ r with _value: float(v: r._value) }))
|> drop(columns: ["_start", “_stop”,“table”,"_measurement"])
|> group(columns: ["_time","_field"])
|> sum(column: “_value”)
|> group(columns: ["_field"])
|>reduce(fn: (r,accumulator) => ({
base_value: if float(v: accumulator.base_value) > float(v: r._value) then accumulator.base_value else r._value,
change_pcntage : int(v: (r._value-accumulator.base_value) / accumulator.base_value),
absolute_change : r._value-accumulator.base_value,
}),
identity: {base_value: 0,change_pcntage: 0,absolute_change : 0}
)
|> filter(fn:(r) => r.change_pcntage >1 and r.absolute_change >50)