Class PigRelBuilder


  • public class PigRelBuilder
    extends RelBuilder
    Extension to RelBuilder for Pig relational operators.
    • Field Detail

      • lastAlias

        private java.lang.String lastAlias
    • Method Detail

      • scan

        public PigRelBuilder scan​(java.lang.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​(java.lang.Iterable<java.lang.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​(java.lang.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​(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,
                                   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:
        groupKeys - One of more group keys; use RelBuilder.groupKey() for ALL
        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
        Returns:
        This builder
      • getAlias

        public java.lang.String getAlias()
      • as

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