Class DerivativeFlux

All Implemented Interfaces:
Expression, HasImports

public final class DerivativeFlux extends AbstractParametrizedFlux
Computes the time based difference between subsequent non null records. See SPEC.

Options

  • unit - The time duration to use for the result [duration]
  • nonNegative - Indicates if the derivative is allowed to be negative [boolean].
  • columns - List of columns on which to compute the derivative [array of strings].
  • timeColumn - The source column for the time values. Defaults to `_time` [string].

Example

 Flux flux = Flux
     .from("telegraf")
     .derivative(1L, ChronoUnit.MINUTES);

 Flux flux = Flux
     .from("telegraf")
     .derivative()
         .withUnit(10L, ChronoUnit.DAYS)
         .withNonNegative(true)
         .withColumns(new String[]{"columnCompare_1", "columnCompare_2"})
         .withTimeColumn("_timeColumn");
 
Author:
Jakub Bednar (bednar@github) (03/07/2018 14:28)
  • Constructor Details

    • DerivativeFlux

      public DerivativeFlux(@Nonnull Flux source)
  • Method Details

    • operatorName

      @Nonnull protected String operatorName()
      Specified by:
      operatorName in class AbstractParametrizedFlux
      Returns:
      name of function
    • withUnit

      @Nonnull public DerivativeFlux withUnit(@Nonnull Long duration, @Nonnull ChronoUnit unit)
      Parameters:
      duration - the time duration to use for the result
      unit - a ChronoUnit determining how to interpret the duration parameter
      Returns:
      this
    • withUnit

      @Nonnull public DerivativeFlux withUnit(@Nonnull String unit)
      Parameters:
      unit - the time duration to use for the result
      Returns:
      this
    • withNonNegative

      @Nonnull public DerivativeFlux withNonNegative(boolean useStartTime)
      Parameters:
      useStartTime - Indicates if the derivative is allowed to be negative
      Returns:
      this
    • withColumns

      @Nonnull public DerivativeFlux withColumns(@Nonnull String[] columns)
      Parameters:
      columns - List of columns on which to compute the derivative.
      Returns:
      this
    • withColumns

      @Nonnull public DerivativeFlux withColumns(@Nonnull Collection<String> columns)
      Parameters:
      columns - List of columns on which to compute the derivative.
      Returns:
      this
    • withTimeColumn

      @Nonnull public DerivativeFlux withTimeColumn(@Nonnull String timeColumn)
      Parameters:
      timeColumn - The source column for the time values
      Returns:
      this
    • collectImports

      public void collectImports(@Nonnull Set<String> collectedImports)
      Description copied from class: Flux
      Collects all imports of the flux.
      Overrides:
      collectImports in class Flux
      Parameters:
      collectedImports - a set to be filled by the used imports