org.apache.hadoop.mapreduce.lib.aggregate

## Class UserDefinedValueAggregatorDescriptor

- java.lang.Object
- - org.apache.hadoop.mapreduce.lib.aggregate.UserDefinedValueAggregatorDescriptor

- All Implemented Interfaces:
    ValueAggregatorDescriptor
  Direct Known Subclasses:
    UserDefinedValueAggregatorDescriptor

      @InterfaceAudience.Public
       @InterfaceStability.Stable
      public class UserDefinedValueAggregatorDescriptor
      extends Object
      implements ValueAggregatorDescriptor

  This class implements a wrapper for a user defined value aggregator descriptor. It serves two functions: One is to create an object of ValueAggregatorDescriptor from the name of a user defined class that may be dynamically loaded. The other is to delegate invocations of generateKeyValPairs function to the created object.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ValueAggregatorDescriptor` | `theAggregatorDescriptor`

    - ### Fields inherited from interface org.apache.hadoop.mapreduce.lib.aggregate.ValueAggregatorDescriptor

      `ONE, TYPE_SEPARATOR`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UserDefinedValueAggregatorDescriptor(String className, org.apache.hadoop.conf.Configuration conf)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `configure(org.apache.hadoop.conf.Configuration conf)` Do nothing.
    `static Object` | `createInstance(String className)` Create an instance of the given class
    `ArrayList<Map.Entry<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>>` | `generateKeyValPairs(Object key, Object val)` Generate a list of aggregation-id/value pairs for the given key/value pairs by delegating the invocation to the real object.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### theAggregatorDescriptor

          protected ValueAggregatorDescriptor theAggregatorDescriptor

  - ### Constructor Detail

    - #### UserDefinedValueAggregatorDescriptor

          public UserDefinedValueAggregatorDescriptor(String className,
                                                      org.apache.hadoop.conf.Configuration conf)

      Parameters:
        `className` - the class name of the user defined descriptor class
        `conf` - a configure object used for decriptor configuration

  - ### Method Detail

    - #### createInstance

          public static Object createInstance(String className)

      Create an instance of the given class
      Parameters:
        `className` - the name of the class
      Returns:
        a dynamically created instance of the given class

    - #### generateKeyValPairs

          public ArrayList<Map.Entry<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>> generateKeyValPairs(Object key,
                                                                                                               Object val)

      Generate a list of aggregation-id/value pairs for the given key/value pairs by delegating the invocation to the real object.
      Specified by:
        `generateKeyValPairs` in interface `ValueAggregatorDescriptor`
      Parameters:
        `key` - input key
        `val` - input value
      Returns:
        a list of aggregation id/value pairs. An aggregation id encodes an aggregation type which is used to guide the way to aggregate the value in the reduce/combiner phrase of an Aggregate based job.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`
      Returns:
        the string representation of this object.

    - #### configure

          public void configure(org.apache.hadoop.conf.Configuration conf)

      Do nothing.
      Specified by:
        `configure` in interface `ValueAggregatorDescriptor`
      Parameters:
        `conf` - a Configuration object that may contain the information that can be used to configure the object.

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.