Class Flux
- All Implemented Interfaces:
Expression
,HasImports
- Direct Known Subclasses:
AbstractParametrizedFlux
,ExpressionFlux
,VariableAssignment
Flux Specification
The functions:
AggregateWindow
FromFlux
CountFlux
CovarianceFlux
CumulativeSumFlux
DerivativeFlux
DifferenceFlux
DistinctFlux
DropFlux
DuplicateFlux
ElapsedFlux
FillFlux
FilterFlux
FirstFlux
GroupFlux
IntegralFlux
JoinFlux
KeepFlux
LastFlux
LimitFlux
MapFlux
MaxFlux
MeanFlux
MinFlux
QuantileFlux
PivotFlux
RangeFlux
RenameFlux
SampleFlux
SetFlux
TimeShiftFlux
SkewFlux
SortFlux
SpreadFlux
StddevFlux
SumFlux
ToFlux
ToBoolFlux
ToIntFlux
ToFloatFlux
ToDurationFlux
ToStringFlux
ToTimeFlux
ToUIntFlux
WindowFlux
YieldFlux
ExpressionFlux
- Author:
- Jakub Bednar (bednar@github) (22/06/2018 10:16)
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Flux
Adds a new import to this flux.final AggregateWindow
Applies an aggregate or selector function to fixed windows of time.final AggregateWindow
aggregateWindow
(Long every, ChronoUnit everyUnit, String namedFunction) Applies an aggregate or selector function to fixed windows of time.abstract void
appendActual
(Map<String, Object> parameters, StringBuilder builder) Append actual Flux function to Flux query.static ArrayFromFlux
Constructs a table from an array of records.static ArrayFromFlux
Constructs a table from an array of records.asVariable
(String name) Converts this flux to a variable assignment so multiple fluxes can be used in conjunction withExpressions
.void
collectImports
(Set<String> collectedImports) Collects all imports of the flux.final ColumnsFlux
columns()
Lists the column labels of input tables.final ColumnsFlux
Lists the column labels of input tables.final CountFlux
count()
Counts the number of results.final CountFlux
Counts the number of results.final CovarianceFlux
Covariance computes the covariance between two columns.final CovarianceFlux
covariance
(String[] columns) Covariance computes the covariance between two columns.final CovarianceFlux
covariance
(String[] columns, boolean pearsonr) Covariance computes the covariance between two columns.final CovarianceFlux
covariance
(String[] columns, boolean pearsonr, String valueDst) Covariance computes the covariance between two columns.final CovarianceFlux
covariance
(String[] columns, String valueDst) Covariance computes the covariance between two columns.final CovarianceFlux
covariance
(Collection<String> columns) Covariance computes the covariance between two columns.final CovarianceFlux
covariance
(Collection<String> columns, boolean pearsonr) Covariance computes the covariance between two columns.final CovarianceFlux
covariance
(Collection<String> columns, boolean pearsonr, String valueDst) Covariance computes the covariance between two columns.final CovarianceFlux
covariance
(Collection<String> columns, String valueDst) Covariance computes the covariance between two columns.final CumulativeSumFlux
Computes a running sum for non null records in the table.final CumulativeSumFlux
cumulativeSum
(String[] columns) Computes a running sum for non null records in the table.final CumulativeSumFlux
cumulativeSum
(Collection<String> columns) Computes a running sum for non null records in the table.final DerivativeFlux
Computes the time based difference between subsequent non null records.final DerivativeFlux
derivative
(Long duration, ChronoUnit unit) Computes the time based difference between subsequent non null records.final DifferenceFlux
Difference computes the difference between subsequent non null records.final DifferenceFlux
difference
(boolean nonNegative) Difference computes the difference between subsequent non null records.final DifferenceFlux
difference
(String[] columns) Difference computes the difference between subsequent non null records.final DifferenceFlux
difference
(String[] columns, boolean nonNegative) Difference computes the difference between subsequent non null records.final DifferenceFlux
difference
(Collection<String> columns) Difference computes the difference between subsequent non null records.final DifferenceFlux
difference
(Collection<String> columns, boolean nonNegative) Difference computes the difference between subsequent non null records.final DistinctFlux
distinct()
Distinct produces the unique values for a given column.final DistinctFlux
Distinct produces the unique values for a given column.final DropFlux
drop()
Drop will exclude specified columns from a table.final DropFlux
Drop will exclude specified columns from a table.final DropFlux
Drop will exclude specified columns from a table.final DropFlux
drop
(Collection<String> columns) Drop will exclude specified columns from a table.final DuplicateFlux
Duplicate will duplicate a specified column in a table.final DuplicateFlux
Duplicate will duplicate a specified column in a table.final ElapsedFlux
elapsed()
Elapsed will add a column "elapsed" which measures the time elapsed since the last reading in the series (this method defaults to units of 1 ms).final ElapsedFlux
elapsed
(int count, ChronoUnit unit) Elapsed will add a column "elapsed" which measures the time elapsed since the last reading in the series.final ElapsedFlux
elapsed
(TimeInterval unit) Elapsed will add a column "elapsed" which measures the time elapsed since the last reading in the series.final ElapsedFlux
elapsed
(ChronoUnit unit) Elapsed will add a column "elapsed" which measures the time elapsed since the last reading in the series.final ExpressionFlux
expression
(String expression) Write the custom Flux expression.final FillFlux
fill()
Replaces all null values in input tables with a non-null value.final FillFlux
Replaces all null values in input tables with a non-null value.final FilterFlux
filter()
Returns the first result of the query.final FilterFlux
filter
(Restrictions restrictions) Returns the first result of the query.final FirstFlux
first()
Returns the first result of the query.static FromFlux
Get data from the specified database.static FromFlux
Get data from the specified database.static FromFlux
from
(String bucket, Collection<String> hosts) Get data from the specified database.final <F extends AbstractParametrizedFlux>
FCreate new function with typetype
.final GroupFlux
group()
Groups results by a user-specified set of tags.final GroupFlux
Groups results by a user-specified set of tags.final GroupFlux
Groups results by a user-specified set of tags.final GroupFlux
groupBy
(Collection<String> groupBy) Groups results by a user-specified set of tags.final GroupFlux
groupExcept
(String except) Groups results by a user-specified set of tags.final GroupFlux
groupExcept
(String[] except) Groups results by a user-specified set of tags.final GroupFlux
groupExcept
(Collection<String> except) Groups results by a user-specified set of tags.final IntegralFlux
integral()
For each aggregate column, it outputs the area under the curve of non null records.final IntegralFlux
integral
(Long duration, ChronoUnit unit) For each aggregate column, it outputs the area under the curve of non null records.final InterpolateLinearFlux
The `interpolate.linear` function inserts rows at regular intervals using linear interpolation to determine values for inserted rows.final InterpolateLinearFlux
interpolateLinear
(Long duration, ChronoUnit unit) The `interpolate.linear` function inserts rows at regular intervals using linear interpolation to determine values for inserted rows.static JoinFlux
join()
Join two time series together on time and the list of tags.static JoinFlux
Join two time series together on time and the list of tags.final KeepFlux
keep()
It will return a table containing only columns that are specified.final KeepFlux
It will return a table containing only columns that are specified.final KeepFlux
It will return a table containing only columns that are specified.final KeepFlux
keep
(Collection<String> columns) It will return a table containing only columns that are specified.final LastFlux
last()
Returns the last result of the query.final LastFlux
Returns the last result of the query.final LimitFlux
limit()
Restricts the number of rows returned in the results.final LimitFlux
limit
(int numberOfResults) Restricts the number of rows returned in the results.final LimitFlux
limit
(int numberOfResults, int offset) Restricts the number of rows returned in the results.final MapFlux
map()
Applies a function to each row of the table.final MapFlux
Applies a function to each row of the table.final MaxFlux
max()
Returns the max value within the results.final MaxFlux
Returns the max value within the results.final MeanFlux
mean()
Returns the mean of the values within the results.final MeanFlux
Returns the mean of the values within the results.final MinFlux
min()
Returns the min value within the results.final MinFlux
Returns the min value within the results.final PivotFlux
pivot()
Pivot collects values stored vertically (column-wise) in a table and aligns them horizontally (row-wise) into logical sets.final PivotFlux
Pivot collects values stored vertically (column-wise) in a table and aligns them horizontally (row-wise) into logical sets.final PivotFlux
pivot
(Collection<String> rowKey, Collection<String> columnKey, String valueColumn) Pivot collects values stored vertically (column-wise) in a table and aligns them horizontally (row-wise) into logical sets.final QuantileFlux
quantile()
Quantile is both an aggregate operation and a selector operation depending on selected options.final QuantileFlux
Quantile is both an aggregate operation and a selector operation depending on selected options.final QuantileFlux
quantile
(Float quantile, QuantileFlux.MethodType method) Quantile is both an aggregate operation and a selector operation depending on selected options.final QuantileFlux
quantile
(Float quantile, QuantileFlux.MethodType method, Float compression) Quantile is both an aggregate operation and a selector operation depending on selected options.final QuantileFlux
quantile
(String column, Float quantile, QuantileFlux.MethodType method, Float compression) Quantile is both an aggregate operation and a selector operation depending on selected options.final RangeFlux
range()
Filters the results by time boundaries.final RangeFlux
Filters the results by time boundaries.final RangeFlux
Filters the results by time boundaries.final RangeFlux
range
(Long start, Long stop, ChronoUnit unit) Filters the results by time boundaries.final RangeFlux
range
(Long start, ChronoUnit unit) Filters the results by time boundaries.final RangeFlux
Filters the results by time boundaries.final RangeFlux
Filters the results by time boundaries.final ReduceFlux
reduce()
Reduce aggregates records in each table according to the reducer.final ReduceFlux
Reduce aggregates records in each table according to the reducer.final RenameFlux
rename()
Rename will rename specified columns in a table.final RenameFlux
Rename will rename specified columns in a table.final RenameFlux
Rename will rename specified columns in a table.final SampleFlux
sample()
Sample values from a table.final SampleFlux
sample
(int n) Sample values from a table.final SampleFlux
sample
(int n, int pos) Sample values from a table.final SetFlux
set()
Assigns a static value to each record.final SetFlux
Assigns a static value to each record.final SkewFlux
skew()
Skew of the results.final SkewFlux
Skew of the results.final SortFlux
sort()
Sorts the results by the specified columns Default sort is ascending.final SortFlux
sort
(boolean desc) Sorts the results by the specified columns Default sort is ascending.final SortFlux
Sorts the results by the specified columns Default sort is ascending.final SortFlux
Sorts the results by the specified columns Default sort is ascending.final SortFlux
sort
(Collection<String> columns) Sorts the results by the specified columns Default sort is ascending.final SortFlux
sort
(Collection<String> columns, boolean desc) Sorts the results by the specified columns Default sort is ascending.final SpreadFlux
spread()
Difference between min and max values.final SpreadFlux
Difference between min and max values.final StddevFlux
stddev()
Standard Deviation of the results.final StddevFlux
Standard Deviation of the results.final SumFlux
sum()
Sum of the results.final SumFlux
Sum of the results.final TailFlux
tail()
Caps the number of records in output tables.final TailFlux
tail
(int numberOfResults) Caps the number of records in output tables.final TailFlux
tail
(int numberOfResults, int offset) Caps the number of records in output tables.final TimeShiftFlux
Shift add a fixed duration to time columns.final TimeShiftFlux
timeShift
(Long amount, ChronoUnit unit) Shift add a fixed duration to time columns.final TimeShiftFlux
timeShift
(Long amount, ChronoUnit unit, String[] columns) Shift add a fixed duration to time columns.final TimeShiftFlux
timeShift
(Long amount, ChronoUnit unit, Collection<String> columns) Shift add a fixed duration to time columns.final ToFlux
to()
To operation takes data from a stream and writes it to a bucket.final ToFlux
To operation takes data from a stream and writes it to a bucket.final ToFlux
To operation takes data from a stream and writes it to a bucket.final ToFlux
To operation takes data from a stream and writes it to a bucket.final ToFlux
To operation takes data from a stream and writes it to a bucket.final ToFlux
to
(String bucket, String org, String host, String token, String timeColumn, String[] tagColumns, String fieldFn) To operation takes data from a stream and writes it to a bucket.final ToFlux
to
(String bucket, String org, String host, String token, String timeColumn, Collection<String> tagColumns, String fieldFn) To operation takes data from a stream and writes it to a bucket.final ToFlux
To operation takes data from a stream and writes it to a bucket.final ToBoolFlux
toBool()
Convert a value to a bool.final ToDurationFlux
Convert a value to a duration.final ToFloatFlux
toFloat()
Convert a value to a float.final ToIntFlux
toInt()
Convert a value to a int.toString()
Create the Flux query that can be executed by FluxService.Create the Flux query that can be executed by FluxService.final ToStringFlux
Convert a value to a string.final ToTimeFlux
toTime()
Convert a value to a time.final ToUIntFlux
toUInt()
Convert a value to a uint.final TruncateTimeColumnFlux
truncateTimeColumn
(ChronoUnit unit) Truncates all input time values in the _time to a specified unit.static UnionFlux
Merges two or more input streams into a single output stream.final WindowFlux
window()
Groups the results by a given time range.final WindowFlux
window
(Long every, ChronoUnit everyUnit) Groups the results by a given time range.final WindowFlux
window
(Long every, ChronoUnit everyUnit, Long period, ChronoUnit periodUnit) Groups the results by a given time range.final WindowFlux
window
(Long every, ChronoUnit everyUnit, Long period, ChronoUnit periodUnit, Long offset, ChronoUnit offsetUnit) Groups the results by a given time range.final WindowFlux
window
(Long every, ChronoUnit everyUnit, Long period, ChronoUnit periodUnit, Long offset, ChronoUnit offsetUnit, String timeColumn, String startColumn, String stopColumn) Partitions the results by a given time range.final WindowFlux
window
(Long every, ChronoUnit everyUnit, Long period, ChronoUnit periodUnit, Instant offset) Groups the results by a given time range.final WindowFlux
window
(Long every, ChronoUnit everyUnit, Long period, ChronoUnit periodUnit, Instant offset, String timeColumn, String startColumn, String stopColumn) Partitions the results by a given time range.final Flux
withFunction
(String functionName, Object function) Add named function to current function.final Flux
withFunctionNamed
(String functionName, String namedProperty) Add named function to current function.<CALL extends AbstractFunctionCallFlux>
CALLwithPipedFunction
(AbstractFunctionFlux<CALL> fun) Creates a piped function call.final Flux
withPropertyNamed
(String property) Add named property to current function.final Flux
withPropertyNamed
(String fluxName, String namedProperty) Add named property to current function.final Flux
withPropertyValue
(String property, Long amount, ChronoUnit unit) Add string property value to current function that will be quoted (value => "value").final Flux
withPropertyValue
(String propertyName, Object value) Add property value to current function.final Flux
withPropertyValueEscaped
(String property, String value) Add string property value to current function that will be quoted (value => "value").final YieldFlux
yield()
Yield a query results to yielded results.final YieldFlux
Yield a query results to yielded results.
-
Field Details
-
functionsParameters
-
imports
-
-
Constructor Details
-
Flux
public Flux()
-
-
Method Details
-
from
Get data from the specified database.- Parameters:
bucket
- Bucket name- Returns:
FromFlux
-
from
Get data from the specified database.- Parameters:
bucket
- Bucket namehosts
- the Fluxd hosts- Returns:
FromFlux
-
from
Get data from the specified database.- Parameters:
bucket
- Bucket namehosts
- the Fluxd hosts- Returns:
FromFlux
-
aggregateWindow
Applies an aggregate or selector function to fixed windows of time.The parameters had to be defined by:
AggregateWindow.withEvery(Long, ChronoUnit)
AggregateWindow.withEvery(String)
withFunction(String, Object)
AggregateWindow.withAggregateFunction(String)
AggregateWindow.withColumn(String)
AggregateWindow.withTimeSrc(String)
AggregateWindow.withTimeDst(String)
AggregateWindow.withCreateEmpty(boolean)
- Returns:
AggregateWindow
-
aggregateWindow
@Nonnull public final AggregateWindow aggregateWindow(@Nonnull Long every, @Nonnull ChronoUnit everyUnit, @Nonnull String namedFunction) Applies an aggregate or selector function to fixed windows of time.The parameters had to be defined by:
AggregateWindow.withEvery(Long, ChronoUnit)
AggregateWindow.withEvery(String)
withFunction(String, Object)
AggregateWindow.withAggregateFunction(String)
AggregateWindow.withColumn(String)
AggregateWindow.withTimeSrc(String)
AggregateWindow.withTimeDst(String)
AggregateWindow.withCreateEmpty(boolean)
- Parameters:
every
- The duration of windows.everyUnit
- aChronoUnit
determining how to interpret theevery
.namedFunction
- specifies the named aggregate operation to perform.- Returns:
AggregateWindow
-
arrayFrom
Constructs a table from an array of records.- Returns:
ArrayFromFlux
-
arrayFrom
Constructs a table from an array of records.- Parameters:
rows
- Array of records to construct a table with.- Returns:
ArrayFromFlux
-
join
Join two time series together on time and the list of tags.The parameters had to be defined by:
- Returns:
JoinFlux
-
join
@Nonnull public static JoinFlux join(@Nonnull String name1, @Nonnull Flux table1, @Nonnull String name2, @Nonnull Flux table2, @Nonnull String tag, @Nonnull String method) Join two time series together on time and the list of tags.- Parameters:
name1
- table 1 nametable1
- table 1 Flux scriptname2
- table 2 nametable2
- table 2 Flux scripttag
- tag key to joinmethod
- the type of join to be performed- Returns:
JoinFlux
-
keep
It will return a table containing only columns that are specified.The parameters had to be defined by:
- Returns:
KeepFlux
-
keep
It will return a table containing only columns that are specified.- Parameters:
columns
- The list of columns that should be included in the resulting table.- Returns:
KeepFlux
-
keep
It will return a table containing only columns that are specified.- Parameters:
columns
- The list of columns that should be included in the resulting table.- Returns:
DropFlux
-
keep
It will return a table containing only columns that are specified.- Parameters:
function
- The function which takes a column name as a parameter and returns a boolean indicating whether or not the column should be included in the resulting table.- Returns:
DropFlux
-
columns
Lists the column labels of input tables.- Returns:
ColumnsFlux
-
columns
Lists the column labels of input tables.- Parameters:
column
- The name of the output column in which to store the column labels.- Returns:
ColumnsFlux
-
count
Counts the number of results.- Returns:
CountFlux
-
count
Counts the number of results.- Parameters:
column
- The column to aggregate.- Returns:
CountFlux
-
covariance
Covariance computes the covariance between two columns.The parameters had to be defined by:
- Returns:
CovarianceFlux
-
covariance
Covariance computes the covariance between two columns.- Parameters:
columns
- list of columns on which to compute the covariance. Exactly two columns must be provided.- Returns:
CovarianceFlux
-
covariance
Covariance computes the covariance between two columns.- Parameters:
columns
- list of columns on which to compute the covariance. Exactly two columns must be provided.- Returns:
CovarianceFlux
-
covariance
@Nonnull public final CovarianceFlux covariance(@Nonnull Collection<String> columns, boolean pearsonr) Covariance computes the covariance between two columns.- Parameters:
columns
- list of columns on which to compute the covariance. Exactly two columns must be provided.pearsonr
- indicates whether the result should be normalized to be the Pearson R coefficient- Returns:
CovarianceFlux
-
covariance
Covariance computes the covariance between two columns.- Parameters:
columns
- list of columns on which to compute the covariance. Exactly two columns must be provided.pearsonr
- indicates whether the result should be normalized to be the Pearson R coefficient- Returns:
CovarianceFlux
-
covariance
@Nonnull public final CovarianceFlux covariance(@Nonnull Collection<String> columns, @Nonnull String valueDst) Covariance computes the covariance between two columns.- Parameters:
columns
- list of columns on which to compute the covariance. Exactly two columns must be provided.valueDst
- column into which the result will be placed.- Returns:
CovarianceFlux
-
covariance
@Nonnull public final CovarianceFlux covariance(@Nonnull String[] columns, @Nonnull String valueDst) Covariance computes the covariance between two columns.- Parameters:
columns
- list of columns on which to compute the covariance. Exactly two columns must be provided.valueDst
- column into which the result will be placed.- Returns:
CovarianceFlux
-
covariance
@Nonnull public final CovarianceFlux covariance(@Nonnull Collection<String> columns, boolean pearsonr, @Nonnull String valueDst) Covariance computes the covariance between two columns.- Parameters:
columns
- list of columns on which to compute the covariance. Exactly two columns must be provided.pearsonr
- indicates whether the result should be normalized to be the Pearson R coefficientvalueDst
- column into which the result will be placed.- Returns:
CovarianceFlux
-
covariance
@Nonnull public final CovarianceFlux covariance(@Nonnull String[] columns, boolean pearsonr, @Nonnull String valueDst) Covariance computes the covariance between two columns.- Parameters:
columns
- list of columns on which to compute the covariance. Exactly two columns must be provided.pearsonr
- indicates whether the result should be normalized to be the Pearson R coefficientvalueDst
- column into which the result will be placed.- Returns:
CovarianceFlux
-
cumulativeSum
Computes a running sum for non null records in the table.The parameters had to be defined by:
- Returns:
CumulativeSumFlux
-
cumulativeSum
Computes a running sum for non null records in the table.- Parameters:
columns
- the columns on which to operate- Returns:
CumulativeSumFlux
-
cumulativeSum
Computes a running sum for non null records in the table.- Parameters:
columns
- the columns on which to operate- Returns:
CumulativeSumFlux
-
derivative
Computes the time based difference between subsequent non null records.The parameters had to be defined by:
- Returns:
DerivativeFlux
-
derivative
Computes the time based difference between subsequent non null records.- Parameters:
duration
- the time duration to use for the resultunit
- aChronoUnit
determining how to interpret theduration
parameter- Returns:
DerivativeFlux
-
difference
Difference computes the difference between subsequent non null records.The parameters had to be defined by:
- Returns:
DifferenceFlux
-
difference
Difference computes the difference between subsequent non null records.- Parameters:
nonNegative
- indicates if the derivative is allowed to be negative- Returns:
DifferenceFlux
-
difference
Difference computes the difference between subsequent non null records.- Parameters:
columns
- list of columns on which to compute the difference- Returns:
DifferenceFlux
-
difference
Difference computes the difference between subsequent non null records.- Parameters:
columns
- list of columns on which to compute the difference- Returns:
DifferenceFlux
-
difference
@Nonnull public final DifferenceFlux difference(@Nonnull Collection<String> columns, boolean nonNegative) Difference computes the difference between subsequent non null records.- Parameters:
columns
- list of columns on which to compute the differencenonNegative
- indicates if the derivative is allowed to be negative- Returns:
DifferenceFlux
-
difference
Difference computes the difference between subsequent non null records.- Parameters:
columns
- list of columns on which to compute the differencenonNegative
- indicates if the derivative is allowed to be negative- Returns:
DifferenceFlux
-
distinct
Distinct produces the unique values for a given column.The parameters had to be defined by:
- Returns:
DistinctFlux
-
distinct
Distinct produces the unique values for a given column.- Parameters:
column
- The column on which to track unique values.- Returns:
DistinctFlux
-
drop
Drop will exclude specified columns from a table.The parameters had to be defined by:
- Returns:
DropFlux
-
drop
Drop will exclude specified columns from a table.- Parameters:
columns
- The list of columns which should be excluded from the resulting table.- Returns:
DropFlux
-
drop
Drop will exclude specified columns from a table.- Parameters:
columns
- The list of columns which should be excluded from the resulting table.- Returns:
DropFlux
-
drop
Drop will exclude specified columns from a table.- Parameters:
function
- The function which takes a column name as a parameter and returns a boolean indicating whether or not the column should be excluded from the resulting table.- Returns:
DropFlux
-
duplicate
Duplicate will duplicate a specified column in a table.The parameters had to be defined by:
- Returns:
DuplicateFlux
-
duplicate
Duplicate will duplicate a specified column in a table.The parameters had to be defined by:
- Parameters:
column
- the column to duplicateas
- the name that should be assigned to the duplicate column- Returns:
DuplicateFlux
-
elapsed
Elapsed will add a column "elapsed" which measures the time elapsed since the last reading in the series.The unit parameter is defined by
ElapsedFlux.withDuration(com.influxdb.query.dsl.functions.properties.TimeInterval)
.- Parameters:
unit
- theTimeInterval
used for measuring elapsed time.- Returns:
- an
ElapsedFlux
object.
-
elapsed
Elapsed will add a column "elapsed" which measures the time elapsed since the last reading in the series.The unit parameter is defined by
ElapsedFlux.withDuration(com.influxdb.query.dsl.functions.properties.TimeInterval)
.- Parameters:
count
- the number of ChronoUnits used for measuring elapsed time.unit
-ChronoUnit
- Returns:
- an
ElapsedFlux
object.
-
elapsed
Elapsed will add a column "elapsed" which measures the time elapsed since the last reading in the series.In this version the default count is 1. So the interval will be measured only in the provided ChronoUnit.
Internally, the unit parameter is defined by
ElapsedFlux.withDuration(com.influxdb.query.dsl.functions.properties.TimeInterval)
.- Parameters:
unit
- theChronoUnit
used for measuring elapsed time.- Returns:
- an
ElapsedFlux
object.
-
elapsed
Elapsed will add a column "elapsed" which measures the time elapsed since the last reading in the series (this method defaults to units of 1 ms).This version defaults to single millisecond time units.
- Returns:
- an
ElapsedFlux
object.
-
fill
Replaces all null values in input tables with a non-null value.The parameters had to be defined by:
- Returns:
FillFlux
-
fill
Replaces all null values in input tables with a non-null value.- Parameters:
value
- The constant value to use in place of nulls. The type must match the type of the valueColumn.- Returns:
FillFlux
-
filter
Returns the first result of the query.The parameters had to be defined by:
- Returns:
FilterFlux
-
filter
Returns the first result of the query.- Parameters:
restrictions
- filter restrictions- Returns:
FilterFlux
-
first
Returns the first result of the query.- Returns:
FirstFlux
-
group
Groups results by a user-specified set of tags.The parameters had to be defined by:
- Returns:
GroupFlux
-
groupBy
Groups results by a user-specified set of tags.- Parameters:
groupBy
- Group by these specific tag name.- Returns:
GroupFlux
-
groupBy
Groups results by a user-specified set of tags.- Parameters:
groupBy
- Group by these specific tag names.- Returns:
GroupFlux
-
groupBy
Groups results by a user-specified set of tags.- Parameters:
groupBy
- Group by these specific tag names.- Returns:
GroupFlux
-
groupExcept
Groups results by a user-specified set of tags.- Parameters:
except
- Group by all but these tag keys Cannot be used.- Returns:
GroupFlux
-
groupExcept
Groups results by a user-specified set of tags.- Parameters:
except
- Group by all but these tag keys Cannot be used.- Returns:
GroupFlux
-
groupExcept
Groups results by a user-specified set of tags.- Parameters:
except
- Group by all but these tag keys Cannot be used.- Returns:
GroupFlux
-
integral
For each aggregate column, it outputs the area under the curve of non null records.The parameters had to be defined by:
- Returns:
IntegralFlux
-
integral
For each aggregate column, it outputs the area under the curve of non null records.- Parameters:
duration
- Time duration to use when computing the integralunit
- aChronoUnit
determining how to interpret theduration
parameter- Returns:
IntegralFlux
-
interpolateLinear
The `interpolate.linear` function inserts rows at regular intervals using linear interpolation to determine values for inserted rows.The parameters had to be defined by:
- Returns:
InterpolateLinearFlux
-
interpolateLinear
@Nonnull public final InterpolateLinearFlux interpolateLinear(@Nonnull Long duration, @Nonnull ChronoUnit unit) The `interpolate.linear` function inserts rows at regular intervals using linear interpolation to determine values for inserted rows.- Parameters:
duration
- Time duration to use when computing the interpolationunit
- aChronoUnit
determining how to interpret theduration
parameter- Returns:
InterpolateLinearFlux
-
last
Returns the last result of the query.- Returns:
LastFlux
-
last
Returns the last result of the query.- Parameters:
column
- The column used to verify the existence of a value.- Returns:
LastFlux
-
limit
Restricts the number of rows returned in the results.The parameters had to be defined by:
- Returns:
LimitFlux
-
limit
Restricts the number of rows returned in the results.- Parameters:
numberOfResults
- The number of results- Returns:
LimitFlux
-
limit
Restricts the number of rows returned in the results.- Parameters:
numberOfResults
- The number of resultsoffset
- The number of records to skip per table.- Returns:
LimitFlux
-
map
Applies a function to each row of the table.The parameters had to be defined by:
- Returns:
MapFlux
-
map
Applies a function to each row of the table.- Parameters:
function
- The function for map row of table. Example: "r._value * r._value".- Returns:
MapFlux
-
max
Returns the max value within the results.- Returns:
MaxFlux
-
max
Returns the max value within the results.- Parameters:
column
- The column to use to calculate the maximum value.- Returns:
MaxFlux
-
mean
Returns the mean of the values within the results.- Returns:
MeanFlux
-
mean
Returns the mean of the values within the results.- Parameters:
column
- The column to use to compute the mean.- Returns:
MeanFlux
-
min
Returns the min value within the results.- Returns:
MinFlux
-
min
Returns the min value within the results.- Parameters:
column
- The column to use to calculate the minimum value.- Returns:
MinFlux
-
quantile
Quantile is both an aggregate operation and a selector operation depending on selected options.The parameters had to be defined by:
QuantileFlux.withColumn(String)
QuantileFlux.withQuantile(Float)
QuantileFlux.withCompression(Float)
QuantileFlux.withMethod(String)
QuantileFlux.withMethod(QuantileFlux.MethodType)
withPropertyNamed(String)
withPropertyNamed(String, String)
withPropertyValueEscaped(String, String)
withFunction(String, Object)
withFunctionNamed(String, String)
- Returns:
QuantileFlux
-
quantile
Quantile is both an aggregate operation and a selector operation depending on selected options.- Parameters:
quantile
- value between 0 and 1 indicating the desired quantile- Returns:
QuantileFlux
-
quantile
@Nonnull public final QuantileFlux quantile(@Nonnull Float quantile, @Nonnull QuantileFlux.MethodType method) Quantile is both an aggregate operation and a selector operation depending on selected options.- Parameters:
quantile
- value between 0 and 1 indicating the desired quantilemethod
- method to aggregate- Returns:
QuantileFlux
-
quantile
@Nonnull public final QuantileFlux quantile(@Nonnull Float quantile, @Nonnull QuantileFlux.MethodType method, @Nonnull Float compression) Quantile is both an aggregate operation and a selector operation depending on selected options.- Parameters:
quantile
- value between 0 and 1 indicating the desired quantilemethod
- method to aggregatecompression
- indicates how many centroids to use when compressing the dataset- Returns:
QuantileFlux
-
quantile
@Nonnull public final QuantileFlux quantile(@Nonnull String column, @Nonnull Float quantile, @Nonnull QuantileFlux.MethodType method, @Nonnull Float compression) Quantile is both an aggregate operation and a selector operation depending on selected options.- Parameters:
column
- specifies a column to aggregatequantile
- value between 0 and 1 indicating the desired quantilemethod
- method to aggregatecompression
- indicates how many centroids to use when compressing the dataset.- Returns:
QuantileFlux
-
pivot
Pivot collects values stored vertically (column-wise) in a table and aligns them horizontally (row-wise) into logical sets.The parameters had to be defined by:
- Returns:
PivotFlux
-
pivot
@Nonnull public final PivotFlux pivot(@Nonnull String[] rowKey, @Nonnull String[] columnKey, @Nonnull String valueColumn) Pivot collects values stored vertically (column-wise) in a table and aligns them horizontally (row-wise) into logical sets.- Parameters:
rowKey
- the columns used to uniquely identify a row for the outputcolumnKey
- the columns used to pivot values onto each row identified by the rowKey.valueColumn
- the single column that contains the value to be moved around the pivot- Returns:
PivotFlux
-
pivot
@Nonnull public final PivotFlux pivot(@Nonnull Collection<String> rowKey, @Nonnull Collection<String> columnKey, @Nonnull String valueColumn) Pivot collects values stored vertically (column-wise) in a table and aligns them horizontally (row-wise) into logical sets.- Parameters:
rowKey
- the columns used to uniquely identify a row for the outputcolumnKey
- the columns used to pivot values onto each row identified by the rowKey.valueColumn
- the single column that contains the value to be moved around the pivot- Returns:
PivotFlux
-
range
Filters the results by time boundaries.The parameters had to be defined by:
- Returns:
RangeFlux
-
range
Filters the results by time boundaries.- Parameters:
start
- Specifies the oldest time to be included in the results- Returns:
RangeFlux
-
range
Filters the results by time boundaries.- Parameters:
start
- Specifies the oldest time to be included in the resultsstop
- Specifies the exclusive newest time to be included in the results- Returns:
RangeFlux
-
range
Filters the results by time boundaries.- Parameters:
start
- Specifies the oldest time to be included in the resultsunit
- aChronoUnit
determining how to interpret thestart
parameter- Returns:
RangeFlux
-
range
@Nonnull public final RangeFlux range(@Nonnull Long start, @Nonnull Long stop, @Nonnull ChronoUnit unit) Filters the results by time boundaries.- Parameters:
start
- Specifies the oldest time to be included in the resultsstop
- Specifies the exclusive newest time to be included in the resultsunit
- aChronoUnit
determining how to interpret thestart
andstop
parameter- Returns:
RangeFlux
-
range
Filters the results by time boundaries.- Parameters:
start
- Specifies the oldest time (Unix timestamp in seconds) to be included in the resultsstop
- Specifies the exclusive newest time (Unix timestamp in seconds) to be included in the results- Returns:
RangeFlux
-
range
Filters the results by time boundaries.- Parameters:
start
- Specifies the oldest time (Unix timestamp in seconds) to be included in the results- Returns:
RangeFlux
-
reduce
Reduce aggregates records in each table according to the reducer.The parameters had to be defined by:
- Returns:
ReduceFlux
-
reduce
Reduce aggregates records in each table according to the reducer.- Parameters:
function
- Function to apply to each record. Example: "{sum: r._value + accumulator.sum}".identity
- An initial value to use when creating a reducer. Example: "{sum: 0.0}".- Returns:
ReduceFlux
-
rename
Rename will rename specified columns in a table.The parameters had to be defined by:
- Returns:
RenameFlux
-
rename
Rename will rename specified columns in a table.- Parameters:
columns
- The map of columns to rename and their corresponding new names.- Returns:
RenameFlux
-
rename
Rename will rename specified columns in a table.- Parameters:
function
- The function which takes a single string parameter (the old column name) and returns a string representing the new column name.- Returns:
RenameFlux
-
sample
Sample values from a table.The parameters had to be defined by:
- Returns:
SampleFlux
-
sample
Sample values from a table.- Parameters:
n
- Sample every Nth element.- Returns:
SampleFlux
-
sample
Sample values from a table.- Parameters:
n
- Sample every Nth element.pos
- Position offset from start of results to begin sampling. Must be less than @{code n}.- Returns:
SampleFlux
-
set
Assigns a static value to each record.The parameters had to be defined by:
- Returns:
SetFlux
-
set
Assigns a static value to each record.- Parameters:
key
- label for the column. Has to be defined.value
- value for the column. Has to be defined.- Returns:
SetFlux
-
timeShift
Shift add a fixed duration to time columns.The parameters had to be defined by:
- Returns:
TimeShiftFlux
-
timeShift
Shift add a fixed duration to time columns.- Parameters:
amount
- The amount to add to each time valueunit
- aChronoUnit
determining how to interpret theamount
parameter- Returns:
TimeShiftFlux
-
timeShift
@Nonnull public final TimeShiftFlux timeShift(@Nonnull Long amount, @Nonnull ChronoUnit unit, @Nonnull String[] columns) Shift add a fixed duration to time columns.- Parameters:
amount
- The amount to add to each time valueunit
- aChronoUnit
determining how to interpret theamount
parametercolumns
- The list of all columns that should be shifted.- Returns:
TimeShiftFlux
-
timeShift
@Nonnull public final TimeShiftFlux timeShift(@Nonnull Long amount, @Nonnull ChronoUnit unit, @Nonnull Collection<String> columns) Shift add a fixed duration to time columns.- Parameters:
amount
- The amount to add to each time valueunit
- aChronoUnit
determining how to interpret theamount
parametercolumns
- The list of all columns that should be shifted.- Returns:
TimeShiftFlux
-
skew
Skew of the results.- Returns:
SkewFlux
-
skew
Skew of the results.- Parameters:
column
- The column on which to operate.- Returns:
SkewFlux
-
sort
Sorts the results by the specified columns Default sort is ascending.- Returns:
SortFlux
-
sort
Sorts the results by the specified columns Default sort is ascending.- Parameters:
desc
- use the descending sorting- Returns:
SortFlux
-
sort
Sorts the results by the specified columns Default sort is ascending.- Parameters:
columns
- columns used to sort- Returns:
SortFlux
-
sort
Sorts the results by the specified columns Default sort is ascending.- Parameters:
columns
- columns used to sort- Returns:
SortFlux
-
sort
Sorts the results by the specified columns Default sort is ascending.- Parameters:
columns
- columns used to sortdesc
- use the descending sorting- Returns:
SortFlux
-
sort
Sorts the results by the specified columns Default sort is ascending.- Parameters:
columns
- columns used to sortdesc
- use the descending sorting- Returns:
SortFlux
-
spread
Difference between min and max values.- Returns:
SpreadFlux
-
spread
Difference between min and max values.- Parameters:
column
- The column on which to operate.- Returns:
SpreadFlux
-
stddev
Standard Deviation of the results.- Returns:
StddevFlux
-
stddev
Standard Deviation of the results.- Parameters:
column
- The column on which to operate.- Returns:
StddevFlux
-
sum
Sum of the results.- Returns:
SumFlux
-
sum
Sum of the results.- Parameters:
column
- The column on which to operate.- Returns:
SumFlux
-
tail
Caps the number of records in output tables.The parameters had to be defined by:
- Returns:
TailFlux
-
tail
Caps the number of records in output tables.- Parameters:
numberOfResults
- The number of results- Returns:
TailFlux
-
tail
Caps the number of records in output tables.- Parameters:
numberOfResults
- The number of resultsoffset
- The number of records to skip per table.- Returns:
TailFlux
-
to
To operation takes data from a stream and writes it to a bucket.The parameters had to be defined by:
ToFlux.withBucket(String)
ToFlux.withBucketID(String)
ToFlux.withOrg(String)
ToFlux.withOrgID(String)
ToFlux.withHost(String)
ToFlux.withToken(String)
ToFlux.withTimeColumn(String)
ToFlux.withTagColumns(Collection)
ToFlux.withTagColumns(String[])
ToFlux.withFieldFunction(String)
withPropertyNamed(String)
withPropertyNamed(String, String)
withPropertyValueEscaped(String, String)
- Returns:
ToFlux
-
to
To operation takes data from a stream and writes it to a bucket.- Parameters:
bucket
- The bucket to which data will be written.- Returns:
ToFlux
-
to
To operation takes data from a stream and writes it to a bucket.- Parameters:
bucket
- The bucket to which data will be written.org
- The organization name of the above bucket.- Returns:
ToFlux
-
to
@Nonnull public final ToFlux to(@Nonnull String bucket, @Nonnull String org, @Nonnull String fieldFn) To operation takes data from a stream and writes it to a bucket.- Parameters:
bucket
- The bucket to which data will be written.org
- The organization name of the above bucket.fieldFn
- Function that takes a record from the input table and returns an object.- Returns:
ToFlux
-
to
@Nonnull public final ToFlux to(@Nonnull String bucket, @Nonnull String org, @Nonnull String[] tagColumns, @Nonnull String fieldFn) To operation takes data from a stream and writes it to a bucket.- Parameters:
bucket
- The bucket to which data will be written.org
- The organization name of the above bucket.tagColumns
- The tag columns of the output.fieldFn
- Function that takes a record from the input table and returns an object.- Returns:
ToFlux
-
to
@Nonnull public final ToFlux to(@Nonnull String bucket, @Nonnull String org, @Nonnull Collection<String> tagColumns, @Nonnull String fieldFn) To operation takes data from a stream and writes it to a bucket.- Parameters:
bucket
- The bucket to which data will be written.org
- The organization name of the above bucket.tagColumns
- The tag columns of the output.fieldFn
- Function that takes a record from the input table and returns an object.- Returns:
ToFlux
-
to
@Nonnull public final ToFlux to(@Nonnull String bucket, @Nonnull String org, @Nonnull String host, @Nonnull String token, @Nonnull String timeColumn, @Nonnull String[] tagColumns, @Nonnull String fieldFn) To operation takes data from a stream and writes it to a bucket.- Parameters:
bucket
- The bucket to which data will be written.org
- The organization name of the above bucket.host
- The remote host to write to.token
- The authorization token to use when writing to a remote host.timeColumn
- The time column of the output.tagColumns
- The tag columns of the output.fieldFn
- Function that takes a record from the input table and returns an object.- Returns:
ToFlux
-
to
@Nonnull public final ToFlux to(@Nonnull String bucket, @Nonnull String org, @Nonnull String host, @Nonnull String token, @Nonnull String timeColumn, @Nonnull Collection<String> tagColumns, @Nonnull String fieldFn) To operation takes data from a stream and writes it to a bucket.- Parameters:
bucket
- The bucket to which data will be written.org
- The organization name of the above bucket.host
- The remote host to write to.token
- The authorization token to use when writing to a remote host.timeColumn
- The time column of the output.tagColumns
- The tag columns of the output.fieldFn
- Function that takes a record from the input table and returns an object.- Returns:
ToFlux
-
toBool
Convert a value to a bool.- Returns:
ToBoolFlux
-
toInt
Convert a value to a int.- Returns:
ToIntFlux
-
toFloat
Convert a value to a float.- Returns:
ToFloatFlux
-
toDuration
Convert a value to a duration.- Returns:
ToDurationFlux
-
toStringConvert
Convert a value to a string.- Returns:
ToStringFlux
-
toTime
Convert a value to a time.- Returns:
ToTimeFlux
-
toUInt
Convert a value to a uint.- Returns:
ToUIntFlux
-
truncateTimeColumn
Truncates all input time values in the _time to a specified unit.- Parameters:
unit
- Unit of time to truncate to. Has to be defined.- Returns:
TruncateTimeColumnFlux
-
union
Merges two or more input streams into a single output stream.- Parameters:
tables
- the tables to union- Returns:
UnionFlux
-
window
Groups the results by a given time range.The parameters had to be defined by:
WindowFlux.withEvery(Long, ChronoUnit)
WindowFlux.withPeriod(Long, ChronoUnit)
WindowFlux.withOffset(Long, ChronoUnit)
WindowFlux.withOffset(Instant)
WindowFlux.withTimeColumn(String)
WindowFlux.withStartColumn(String)
WindowFlux.withStartColumn(String)
withPropertyNamed(String)
withPropertyNamed(String, String)
withPropertyValueEscaped(String, String)
- Returns:
WindowFlux
-
window
Groups the results by a given time range.- Parameters:
every
- duration of time between windowseveryUnit
- aChronoUnit
determining how to interpret theevery
- Returns:
WindowFlux
-
window
@Nonnull public final WindowFlux window(@Nonnull Long every, @Nonnull ChronoUnit everyUnit, @Nonnull Long period, @Nonnull ChronoUnit periodUnit) Groups the results by a given time range.- Parameters:
every
- duration of time between windowseveryUnit
- aChronoUnit
determining how to interpret theevery
period
- duration of the windowed partitionperiodUnit
- aChronoUnit
determining how to interpret theperiod
- Returns:
WindowFlux
-
window
@Nonnull public final WindowFlux window(@Nonnull Long every, @Nonnull ChronoUnit everyUnit, @Nonnull Long period, @Nonnull ChronoUnit periodUnit, @Nonnull Instant offset) Groups the results by a given time range.- Parameters:
every
- duration of time between windowseveryUnit
- aChronoUnit
determining how to interpret theevery
period
- duration of the windowed partitionperiodUnit
- aChronoUnit
determining how to interpret theperiod
offset
- The offset duration relative to the location offset- Returns:
WindowFlux
-
window
@Nonnull public final WindowFlux window(@Nonnull Long every, @Nonnull ChronoUnit everyUnit, @Nonnull Long period, @Nonnull ChronoUnit periodUnit, @Nonnull Long offset, @Nonnull ChronoUnit offsetUnit) Groups the results by a given time range.- Parameters:
every
- duration of time between windowseveryUnit
- aChronoUnit
determining how to interpret theevery
period
- duration of the windowed partitionperiodUnit
- aChronoUnit
determining how to interpret theperiod
offset
- The offset duration relative to the location offsetoffsetUnit
- aChronoUnit
determining how to interpret theoffset
- Returns:
WindowFlux
-
window
@Nonnull public final WindowFlux window(@Nonnull Long every, @Nonnull ChronoUnit everyUnit, @Nonnull Long period, @Nonnull ChronoUnit periodUnit, @Nonnull Long offset, @Nonnull ChronoUnit offsetUnit, @Nonnull String timeColumn, @Nonnull String startColumn, @Nonnull String stopColumn) Partitions the results by a given time range.- Parameters:
every
- duration of time between windowseveryUnit
- aChronoUnit
determining how to interpret theevery
period
- duration of the windowed partitionperiodUnit
- aChronoUnit
determining how to interpret theperiod
offset
- The offset duration relative to the location offsetoffsetUnit
- aChronoUnit
determining how to interpret theoffset
timeColumn
- name of the time column to usestartColumn
- name of the column containing the window start timestopColumn
- name of the column containing the window stop time- Returns:
WindowFlux
-
window
@Nonnull public final WindowFlux window(@Nonnull Long every, @Nonnull ChronoUnit everyUnit, @Nonnull Long period, @Nonnull ChronoUnit periodUnit, @Nonnull Instant offset, @Nonnull String timeColumn, @Nonnull String startColumn, @Nonnull String stopColumn) Partitions the results by a given time range.- Parameters:
every
- duration of time between windowseveryUnit
- aChronoUnit
determining how to interpret theevery
period
- duration of the windowed partitionperiodUnit
- aChronoUnit
determining how to interpret theperiod
offset
- The offset duration relative to the location offsettimeColumn
- name of the time column to usestartColumn
- name of the column containing the window start timestopColumn
- name of the column containing the window stop time- Returns:
WindowFlux
-
yield
Yield a query results to yielded results.The parameters had to be defined by:
- Returns:
YieldFlux
-
yield
Yield a query results to yielded results.- Parameters:
name
- The unique name to give to yielded results. Has to be defined.- Returns:
YieldFlux
-
expression
Write the custom Flux expression.- Parameters:
expression
- flux expression- Returns:
ExpressionFlux
-
function
Create new function with typetype
.Flux flux = Flux .from("telegraf") .function(FilterMeasurement.class) .withName("cpu") .sum();
- Type Parameters:
F
- function type- Parameters:
type
- function type- Returns:
- function with
type
-
withPipedFunction
public <CALL extends AbstractFunctionCallFlux> CALL withPipedFunction(AbstractFunctionFlux<CALL> fun) Creates a piped function call.Example Definition
public static class MultByXFunction extends AbstractFunctionFlux<MultByXFunction.MultByXFunctionCall> { public MultByXFunction() { super("multByX", new FreestyleExpression("tables") .map("(r) => ({r with _value: r._value * x})"), MultByXFunctionCall::new, new Parameter("tables").withPipeForward(true), new Parameter("x")); } public static class MultByXFunctionCall extends AbstractFunctionCallFlux { public MultByXFunctionCall(@Nonnull String name) { super(name); } public MultByXFunctionCall withX(final Number x) { this.withPropertyValue("x", x); return this; } } }
Example Usage
MultByXFunction multByX = new MultByXFunction(); Expressions flux = new Expressions( multByX, Flux.from("telegraph") .withPipedFunction(multByX) .withX(42.) .count() );
- Type Parameters:
CALL
- the type of the invocation- Parameters:
fun
- the function to be piped- Returns:
- the invocation
-
withPropertyNamed
Add named property to current function.FluxChain fluxChain = new FluxChain() .withPropertyNamed("every", 15, ChronoUnit.MINUTES) .withPropertyNamed("period", 20L, ChronoUnit.SECONDS) .withPropertyNamed("start", -50, ChronoUnit.DAYS) .withPropertyNamed("round", 1L, ChronoUnit.HOURS); Flux flux = Flux.from("telegraf") .window() .withPropertyNamed("every") .withPropertyNamed("period") .withPropertyNamed("start") .withPropertyNamed("round") .sum(); flux.print(fluxChain);
- Parameters:
property
- name in Flux query and in named properties- Returns:
- a current function.
-
withPropertyNamed
@Nonnull public final Flux withPropertyNamed(@Nonnull String fluxName, @Nonnull String namedProperty) Add named property to current function.Flux flux = Flux .from("telegraf") .limit() .withPropertyNamed("n", "limit") .sum(); FluxChain fluxChain = new FluxChain() .withPropertyNamed("limit", 15); flux.print(fluxChain);
- Parameters:
fluxName
- name in Flux querynamedProperty
- name in named properties- Returns:
- a current function
-
withPropertyValue
Add property value to current function.Flux flux = Flux .from("telegraf") .limit() .withPropertyValue("n", 5) .sum();
- Parameters:
propertyName
- name in Flux queryvalue
- value of property. If null than ignored.- Returns:
- a current function
-
withFunction
Add named function to current function.Flux flux = Flux .from("telegraf") .drop() .withFunction("fn", "column =~ free*");
- Parameters:
functionName
- name in Flux queryfunction
- defined function- Returns:
- a current function
-
withFunctionNamed
@Nonnull public final Flux withFunctionNamed(@Nonnull String functionName, @Nonnull String namedProperty) Add named function to current function.Map<String, Object> parameters = new HashMap<>(); parameters.put("function", "r._value * 10"); Flux flux = Flux .from("telegraf") .range(-12L, ChronoUnit.HOURS) .map() .withFunctionNamed("fn: (r)", "function");
- Parameters:
functionName
- name in Flux querynamedProperty
- name in named properties- Returns:
- a current function
-
withPropertyValue
@Nonnull public final Flux withPropertyValue(@Nonnull String property, @Nullable Long amount, @Nullable ChronoUnit unit) Add string property value to current function that will be quoted (value => "value").Flux flux = Flux .from("telegraf") .window(5, ChronoUnit.MINUTES) .withPropertyValueEscaped("startColumn", "differentCol") .sum();
- Parameters:
property
- name of property in Flux queryamount
- the amount of the duration, measured in terms of the unit, positive or negativeunit
- the unit that the duration is measured in, must have an exact duration. If null than ignored.- Returns:
- a current function
-
withPropertyValueEscaped
@Nonnull public final Flux withPropertyValueEscaped(@Nonnull String property, @Nullable String value) Add string property value to current function that will be quoted (value => "value").Flux flux = Flux .from("telegraf") .window(5, ChronoUnit.MINUTES) .withPropertyValueEscaped("startColumn", "differentCol") .sum();
- Parameters:
property
- name of property in Flux queryvalue
- value of property. If null than ignored.- Returns:
- a current function
-
appendActual
public abstract void appendActual(@Nonnull Map<String, Object> parameters, @Nonnull StringBuilder builder) Append actual Flux function to Flux query.- Parameters:
parameters
- named parameters for Flux querybuilder
- Flux query chaing
-
toString
Create the Flux query that can be executed by FluxService. -
toString
Create the Flux query that can be executed by FluxService.- Parameters:
parameters
- flux query named parameters- Returns:
- Flux query
-
toString
- Specified by:
toString
in interfaceExpression
- Parameters:
parameters
- parameters to resolveprependImports
- true, if the imports should be prepended- Returns:
- the string representation of the expression
-
asVariable
Converts this flux to a variable assignment so multiple fluxes can be used in conjunction withExpressions
.- Parameters:
name
- the name of the variable- Returns:
- a variable assignment
- See Also:
-
getImports
- Specified by:
getImports
in interfaceHasImports
- Returns:
- all used imports of this flux
-
collectImports
Collects all imports of the flux.- Parameters:
collectedImports
- a set to be filled by the used imports
-
addImport
Adds a new import to this flux.- Parameters:
pImport
- the import to be added- Returns:
- this
-