hadoop

## Class CountMinorKeys

- java.lang.Object
- - org.apache.hadoop.conf.Configured
  - - hadoop.CountMinorKeys

- All Implemented Interfaces:
    Configurable, Tool

      public class CountMinorKeys
      extends Configured
      implements Tool

  A simple example demonstrating how to use the Oracle NoSQL DB Hadoop oracle.kv.hadoop.KVInputFormat class to read data from NoSQL Database in a Map/Reduce job and count the number of records for each major key in the store. The map() function is passed the Key and Value for each record in the KV Store and outputs k/v pairs containing the major path components as the output key and a value of 1. The reduce step sums the values for each of the records with the same key. This M/R task is similar to the ubiquitous Hadoop Map/Reduce WordCount example. The KV Keys passed to the Map function are in the canonical format described in the javadoc for the oracle.kv.Key.toString() method. The KVInputFormat and related classes are located in the lib/kvclient.jar file so this must be included in the Hadoop classpath at runtime. The arguments to the program are the kvstore name, the helperHost:port pair, the HDFS output path and optionally, the login file path. For example, if you build this class (and its subclasses) and put it into myjar.jar, you can invoke with a command similar to this:

       export HADOOP_CLASSPATH=...:KVHOME/lib/kvstore.jar
       bin/hadoop jar myjar.jar hadoop.CountMinorKeys \
                  -libjars KVHOME/lib/kvstore.jar \
                  mystore myhost:myport /myHDFSoutputdir [/myHDFSLoginfile]

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `CountMinorKeys.Map`
    `static class` | `CountMinorKeys.Reduce`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CountMinorKeys()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `main(String[] args)`
    `int` | `run(String[] args)`

    - ### Methods inherited from class org.apache.hadoop.conf.Configured

      `getConf, setConf`

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

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

    - ### Methods inherited from interface org.apache.hadoop.conf.Configurable

      `getConf, setConf`

- - ### Constructor Detail

    - #### CountMinorKeys

          public CountMinorKeys()

  - ### Method Detail

    - #### run

          public int run(String[] args)
                  throws Exception

      Specified by:
        `run` in interface `Tool`
      Throws:
        `Exception`

    - #### main

          public static void main(String[] args)
                           throws Exception

      Throws:
        `Exception`

Copyright (c) 2011, 2014 Oracle and/or its affiliates. All rights reserved.