Class WindowFlux

All Implemented Interfaces:
Expression, HasImports

public final class WindowFlux extends AbstractParametrizedFlux
Groups the results by a given time range. See SPEC.

Options

  • every - Duration of time between windows. Defaults to period's value. [duration]
  • period - Duration of the windowed partition. Defaults to every's value. [duration]
  • offset - The offset duration relative to the location offset. It can be negative, indicating that the offset goes backwards in time. The default aligns the window boundaries to line up with the now option time. [time]
  • timeColumn - Name of the time column to use. Defaults to _time. [string]
  • startColumn - Name of the column containing the window start time. Defaults to _start. [string]
  • stopColumn - Name of the column containing the window stop time. Defaults to _stop. [string]

Example

 Flux flux = Flux
     .from("telegraf")
     .window(15L, ChronoUnit.MINUTES)
     .max();

 Flux flux = Flux
     .from("telegraf")
     .window(15L, ChronoUnit.MINUTES,
             20L, ChronoUnit.SECONDS,
             1L, ChronoUnit.SECONDS)
     .max();
 
Author:
Jakub Bednar (bednar@github) (27/06/2018 12:01)
  • Constructor Details

    • WindowFlux

      public WindowFlux(@Nonnull Flux flux)
  • Method Details

    • operatorName

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

      @Nonnull public WindowFlux withEvery(@Nonnull Long every, @Nonnull ChronoUnit everyUnit)
      Parameters:
      every - duration of time between windows
      everyUnit - a ChronoUnit determining how to interpret the every
      Returns:
      this
    • withEvery

      @Nonnull public WindowFlux withEvery(@Nonnull String every)
      Parameters:
      every - duration of time between windows
      Returns:
      this
    • withPeriod

      @Nonnull public WindowFlux withPeriod(@Nonnull Long period, @Nonnull ChronoUnit periodUnit)
      Parameters:
      period - duration of the windowed partition
      periodUnit - a ChronoUnit determining how to interpret the period
      Returns:
      this
    • withPeriod

      @Nonnull public WindowFlux withPeriod(@Nonnull String period)
      Parameters:
      period - duration of the windowed partition
      Returns:
      this
    • withOffset

      @Nonnull public WindowFlux withOffset(@Nonnull Long offset, @Nonnull ChronoUnit offsetUnit)
      Parameters:
      offset - The offset duration relative to the location offset.
      offsetUnit - a ChronoUnit determining how to interpret the offset
      Returns:
      this
    • withOffset

      @Nonnull public WindowFlux withOffset(@Nonnull Instant offset)
      Parameters:
      offset - The offset duration relative to the location offset.
      Returns:
      this
    • withOffset

      @Nonnull public WindowFlux withOffset(@Nonnull String offset)
      Parameters:
      offset - The offset duration relative to the location offset.
      Returns:
      this
    • withTimeColumn

      @Nonnull public WindowFlux withTimeColumn(@Nonnull String timeColumn)
      Parameters:
      timeColumn - name of the time column to use
      Returns:
      this
    • withStartColumn

      @Nonnull public WindowFlux withStartColumn(@Nonnull String startColumn)
      Parameters:
      startColumn - name of the column containing the window start time
      Returns:
      this
    • withStopCol

      @Nonnull public WindowFlux withStopCol(@Nonnull String stopColumn)
      Parameters:
      stopColumn - name of the column containing the window stop time
      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