Class PigRelBuilder

java.lang.Object
org.apache.calcite.tools.RelBuilder
org.apache.calcite.tools.PigRelBuilder

public class PigRelBuilder extends RelBuilder
Extension to RelBuilder for Pig relational operators.
  • Constructor Details

  • Method Details

    • create

      public static PigRelBuilder create(FrameworkConfig config)
      Creates a PigRelBuilder.
    • scan

      public PigRelBuilder scan(String... tableNames)
      Description copied from class: RelBuilder
      Creates a TableScan of the table with a given name.

      Throws if the table does not exist.

      Returns this builder.

      Overrides:
      scan in class RelBuilder
      Parameters:
      tableNames - Name of table (can optionally be qualified)
    • scan

      public PigRelBuilder scan(Iterable<String> tableNames)
      Description copied from class: RelBuilder
      Creates a TableScan of the table with a given name.

      Throws if the table does not exist.

      Returns this builder.

      Overrides:
      scan in class RelBuilder
      Parameters:
      tableNames - Name of table (can optionally be qualified)
    • load

      public PigRelBuilder load(String path, RexNode loadFunction, RelDataType rowType)
      Loads a data set.

      Equivalent to Pig Latin:

      LOAD 'path' USING loadFunction AS rowType

      loadFunction and rowType are optional.

      Parameters:
      path - File path
      loadFunction - Load function
      rowType - Row type (what Pig calls 'schema')
      Returns:
      This builder
    • distinct

      public PigRelBuilder distinct(org.apache.calcite.tools.PigRelBuilder.Partitioner partitioner, int parallel)
      Removes duplicate tuples in a relation.

      Equivalent Pig Latin:

      alias = DISTINCT alias [PARTITION BY partitioner] [PARALLEL n];
      Parameters:
      partitioner - Partitioner; null means no partitioner
      parallel - Degree of parallelism; negative means unspecified
      Returns:
      This builder
    • group

      public PigRelBuilder group(PigRelBuilder.GroupOption option, org.apache.calcite.tools.PigRelBuilder.Partitioner partitioner, int parallel, RelBuilder.GroupKey... groupKeys)
      Groups the data in one or more relations.

      Pig Latin syntax:

      alias = GROUP alias { ALL | BY expression } [, alias ALL | BY expression ...] [USING 'collected' | 'merge'] [PARTITION BY partitioner] [PARALLEL n];
      Parameters:
      option - Whether to use an optimized method combining the data (COLLECTED for one input or MERGE for two or more inputs)
      partitioner - Partitioner; null means no partitioner
      parallel - Degree of parallelism; negative means unspecified
      groupKeys - One of more group keys; use RelBuilder.groupKey() for ALL
      Returns:
      This builder
    • group

      public PigRelBuilder group(PigRelBuilder.GroupOption option, org.apache.calcite.tools.PigRelBuilder.Partitioner partitioner, int parallel, Iterable<? extends RelBuilder.GroupKey> groupKeys)
    • validateGroupList

      protected void validateGroupList(List<RelBuilder.GroupKey> groupKeyList)
    • getAlias

      public @Nullable String getAlias()
    • as

      public RelBuilder as(String alias)
      As super-class method, but also retains alias for naming of aggregates.
      Overrides:
      as in class RelBuilder