Class SortFlux

All Implemented Interfaces:
Expression, HasImports

public final class SortFlux extends AbstractParametrizedFlux
Sorts the results by the specified columns Default sort is ascending. See SPEC.

Options

  • columns - List of columns used to sort; precedence from left to right. Default is ["value"] [array of strings]
  • desc - Sort results descending. Default false [bool]

Example

 Flux flux = Flux
     .from("telegraf")
     .sort(new String[]{"region", "value"});

     from(bucket:"telegraf")
          |> filter(fn: (r) => r["_measurement"] == "system" AND r["_field"] == "uptime")
          |> range(start:-12h)
          |> sort(desc: true)
 
Author:
Jakub Bednar (bednar@github) (25/06/2018 13:20)
  • Constructor Details

    • SortFlux

      public SortFlux(@Nonnull Flux flux)
  • Method Details

    • operatorName

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

      @Nonnull public SortFlux withDesc(boolean desc)
      Parameters:
      desc - use the descending sorting
      Returns:
      this
    • withColumns

      @Nonnull public SortFlux withColumns(@Nonnull String[] columns)
      Parameters:
      columns - columns used to sort
      Returns:
      this
    • withColumns

      @Nonnull public SortFlux withColumns(@Nonnull Collection<String> columns)
      Parameters:
      columns - columns used to sort
      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