Package com.influxdb.query.dsl.functions
Class AggregateWindow
java.lang.Object
com.influxdb.query.dsl.Flux
com.influxdb.query.dsl.functions.AbstractParametrizedFlux
com.influxdb.query.dsl.functions.AggregateWindow
- All Implemented Interfaces:
Expression
,HasImports
Applies an aggregate or selector function (any function with a column parameter) to fixed windows of time.
See SPEC.
Options
- every - The duration of windows. [duration]
- fn - The aggregate function used in the operation. [function]
- column - The column on which to operate. Defaults to "_value". [string]
- timeSrc - The time column from which time is copied for the aggregate record. Defaults to "_stop". [string]
- timeDst - The “time destination” column to which time is copied for the aggregate record. Defaults to "_time". [string]
- createEmpty - For windows without data, this will create an empty window and fill it with a null aggregate value. Defaults to true. [boolean]
Example
Flux flux = Flux .from("telegraf") .aggregateWindow(10L, ChronoUnit.SECONDS, "mean"); Flux flux = Flux .from("telegraf") .aggregateWindow() .withEvery("10s") .withAggregateFunction("sum") .withColumn("_value") .withTimeSrc("_stop") .withTimeDst("_time") .withCreateEmpty(true); Flux flux = Flux .from("telegraf") .aggregateWindow() .withEvery(5L, ChronoUnit.MINUTES) .withFunction("tables |> quantile(q: 0.99, column:column)");
- Author:
- Jakub Bednar (13/05/2020 08:41)
-
Field Summary
Fields inherited from class com.influxdb.query.dsl.Flux
functionsParameters, imports
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
collectImports
(Set<String> collectedImports) Collects all imports of the flux.protected String
withAggregateFunction
(String namedFunction) withColumn
(String column) withCreateEmpty
(boolean createEmpty) withEvery
(Long every, ChronoUnit everyUnit) withFunction
(String function) withOffset
(Long amount, ChronoUnit unit) withOffset
(String offset) withTimeDst
(String timeDst) withTimeSrc
(String timeSrc) Methods inherited from class com.influxdb.query.dsl.functions.AbstractParametrizedFlux
appendActual, beforeAppendOperatorName
Methods inherited from class com.influxdb.query.dsl.Flux
addImport, aggregateWindow, aggregateWindow, arrayFrom, arrayFrom, asVariable, columns, columns, count, count, covariance, covariance, covariance, covariance, covariance, covariance, covariance, covariance, covariance, cumulativeSum, cumulativeSum, cumulativeSum, derivative, derivative, difference, difference, difference, difference, difference, difference, distinct, distinct, drop, drop, drop, drop, duplicate, duplicate, elapsed, elapsed, elapsed, elapsed, expression, fill, fill, filter, filter, first, from, from, from, function, getImports, group, groupBy, groupBy, groupBy, groupExcept, groupExcept, groupExcept, integral, integral, interpolateLinear, interpolateLinear, join, join, keep, keep, keep, keep, last, last, limit, limit, limit, map, map, max, max, mean, mean, min, min, pivot, pivot, pivot, quantile, quantile, quantile, quantile, quantile, range, range, range, range, range, range, range, reduce, reduce, rename, rename, rename, sample, sample, sample, set, set, skew, skew, sort, sort, sort, sort, sort, sort, spread, spread, stddev, stddev, sum, sum, tail, tail, tail, timeShift, timeShift, timeShift, timeShift, to, to, to, to, to, to, to, to, toBool, toDuration, toFloat, toInt, toString, toString, toString, toStringConvert, toTime, toUInt, truncateTimeColumn, union, window, window, window, window, window, window, window, withFunction, withFunctionNamed, withPipedFunction, withPropertyNamed, withPropertyNamed, withPropertyValue, withPropertyValue, withPropertyValueEscaped, yield, yield
-
Constructor Details
-
AggregateWindow
-
-
Method Details
-
operatorName
- Specified by:
operatorName
in classAbstractParametrizedFlux
- Returns:
- name of function
-
withEvery
- Parameters:
every
- The duration of windows.everyUnit
- aChronoUnit
determining how to interpret theevery
.- Returns:
- this
-
withEvery
- Parameters:
every
- The duration of windows.- Returns:
- this
-
withFunction
- Parameters:
function
- specifies the aggregate operation to perform.- Returns:
- this
-
withAggregateFunction
- Parameters:
namedFunction
- specifies the named aggregate operation to perform.- Returns:
- this
-
withColumn
- Parameters:
column
- The column on which to operate.- Returns:
- this
-
withTimeSrc
- Parameters:
timeSrc
- The time column from which time is copied for the aggregate record.- Returns:
- this
-
withTimeDst
- Parameters:
timeDst
- The “time destination” column to which time is copied for the aggregate record.- Returns:
- this
-
withCreateEmpty
- Parameters:
createEmpty
- For windows without data, this will create an empty window and fill it with a null aggregate value.- Returns:
- this
-
withOffset
- Parameters:
amount
- The offset of windows.unit
- aChronoUnit
determining how to interpret theamount
.- Returns:
- this
-
withOffset
- Parameters:
offset
- The offset of windows.- Returns:
- this
-
collectImports
Description copied from class:Flux
Collects all imports of the flux.- Overrides:
collectImports
in classFlux
- Parameters:
collectedImports
- a set to be filled by the used imports
-