Class JoinFlux

All Implemented Interfaces:
Expression, HasImports

public final class JoinFlux extends AbstractParametrizedFlux
Join two time series together on time and the list of on keys. See SPEC.

Options

  • tables - Map of tables to join. Currently only two tables are allowed. [map of tables]
  • on - List of tag keys that when equal produces a result set. [array of strings]
  • method - An optional parameter that specifies the type of join to be performed.

Example

 Flux cpu = Flux.from("telegraf")
     .filter(Restrictions.and(Restrictions.measurement().equal("cpu"), Restrictions.field().equal("usage_user")))
     .range(-30L, ChronoUnit.MINUTES);

 Flux mem = Flux.from("telegraf")
     .filter(Restrictions.and(Restrictions.measurement().equal("mem"), Restrictions.field().equal("used_percent")))
     .range(-30L, ChronoUnit.MINUTES);

 Flux flux = Flux.join()
     .withTable("cpu", cpu)
     .withTable("mem", mem)
     .withOn("host")
     .withMethod("outer");
 
Author:
Jakub Bednar (bednar@github) (17/07/2018 14:47)
  • Constructor Details

    • JoinFlux

      public JoinFlux()
  • Method Details

    • operatorName

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

      protected void beforeAppendOperatorName(@Nonnull StringBuilder operator, @Nonnull Map<String,Object> parameters)
      Description copied from class: AbstractParametrizedFlux
      Possibility to customize function.
      Overrides:
      beforeAppendOperatorName in class AbstractParametrizedFlux
      Parameters:
      operator - current Flux function
      parameters - parameters
      See Also:
    • withTable

      @Nonnull public JoinFlux withTable(@Nonnull String name, @Nonnull Flux table)
      Map of table to join. Currently, only two tables are allowed.
      Parameters:
      name - table name
      table - Flux script to map table
      Returns:
      this
    • withOn

      @Nonnull public JoinFlux withOn(@Nonnull String tag)
      Parameters:
      tag - Tag key that when equal produces a result set.
      Returns:
      this
    • withOn

      @Nonnull public JoinFlux withOn(@Nonnull String[] tags)
      Parameters:
      tags - List of tag keys that when equal produces a result set.
      Returns:
      this
    • withOn

      @Nonnull public JoinFlux withOn(@Nonnull Collection<String> tags)
      Parameters:
      tags - List of tag keys that when equal produces a result set.
      Returns:
      this
    • withMethod

      @Nonnull public JoinFlux withMethod(@Nonnull String method)
      Parameters:
      method - the type of join to be performed
      Returns:
      this
    • withMethod

      @Nonnull public JoinFlux withMethod(@Nonnull JoinFlux.MethodType method)
      Parameters:
      method - the type of join to be performed
      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