1
votes

What is the difference between the methods Counter.getName() vs Counter.getDisplayName(). I do not see much information from the documentation http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/Counter.html Please clarify.

Thanks,

Venkat

2
The latter is deprecated. - trashgod

2 Answers

1
votes

The Hadoop framework uses the standard Java localization for a readable Counter names. The name is used internally by the framework but what gets displayed when you see the counters is the display name .

To see it in action ,

  1. Create properties file named after the enum in the same directory as the top-level class containing the enum.

  2. The properties file should contain a single property named CounterGroupName, whose value is the display name . Define all the fields with a suffix .name .

Ex: for an enum as follows defined within Employee class

      `enum Counters {  VALID , INVALID }`
  • Create a properties file Employee_Counters.properties file in the same package of Employee. with the following entries

    CounterGroupName=Employment Records
    VALID.name=Valid Employee Records
    INVALID.name=Invalid Employee Records

  • Create another properties file Employee_Counters_fr_FR.properties to display the counter names in French.

  • If the default locale is EN , you would see the counters being displayed with the values supplied in the properties file .

0
votes

getName returns the name of the counter

getDisplayName() returns the user facing name of the counter

Source : http://hadoop.apache.org/docs/r2.0.3-alpha/api/org/apache/hadoop/mapreduce/Counter.html#getName()