Class PivotFlux

All Implemented Interfaces:
Expression, HasImports

public final class PivotFlux extends AbstractParametrizedFlux
Pivot collects values stored vertically (column-wise) in a table and aligns them horizontally (row-wise) into logical sets. See SPEC.

Options

  • rowKey - List of columns used to uniquely identify a row for the output. [array of strings]
  • columnKey - List of columns used to pivot values onto each row identified by the rowKey. [array of strings]
  • valueColumn - Identifies the single column that contains the value to be moved around the pivot [string]

Example

 Flux flux = Flux.from("telegraf")
     .pivot()
         .withRowKey(new String[]{"_time"})
         .withColumnKey(new String[]{"_field"})
         .withValueColumn("_value");
 
Author:
Jakub Bednar (10/10/2018 06:16)
  • Constructor Details

    • PivotFlux

      public PivotFlux(@Nonnull Flux source)
  • Method Details

    • operatorName

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

      @Nonnull public PivotFlux withRowKey(@Nonnull String[] rowKey)
      Parameters:
      rowKey - the columns used to uniquely identify a row for the output.
      Returns:
      this
    • withRowKey

      @Nonnull public PivotFlux withRowKey(@Nonnull Collection<String> rowKey)
      Parameters:
      rowKey - the columns used to uniquely identify a row for the output.
      Returns:
      this
    • withColumnKey

      @Nonnull public PivotFlux withColumnKey(@Nonnull String[] columnKey)
      Parameters:
      columnKey - the columns used to pivot values onto each row identified by the rowKey.
      Returns:
      this
    • withColumnKey

      @Nonnull public PivotFlux withColumnKey(@Nonnull Collection<String> columnKey)
      Parameters:
      columnKey - the columns used to pivot values onto each row identified by the rowKey.
      Returns:
      this
    • withValueColumn

      @Nonnull public PivotFlux withValueColumn(@Nonnull String valueColumn)
      Parameters:
      valueColumn - the single column that contains the value to be moved around the pivot
      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