public class CountTableRows extends Configured implements Tool
oracle.kv.hadoop.table.TableInputFormat to access the
rows of a table in an Oracle NoSQL Database from within a Hadoop
MapReduce job for the purpose of counting the number of records
in the table.
The map function is passed the PrimaryKey and Row for each
record in the KV Store and outputs key/value pairs containing the component
field names of the PrimaryKey as the output key and a value of 1. The
reduce phase then uses the output of the map phase to count the number
of records in the table. This MapReduce task is similar to the ubiquitous
Hadoop MapReduce WordCount example.
The TableInputFormat and related classes are located in the
lib/kvclient.jar file, so kvclient.jar must be included in
the Hadoop libjars classpath at runtime. Additionally, this class
and any dependent classes, must be placed in a separate JAR for inclusion
in the classpath of the application itself. Finally, if this example is to
be run against a secure store, then a third JAR file must be generated that
contains the user's login file, credentials, and trust store. For the
details on how to run this example class, both in a secure and a non-secure
mode, refer to the information presented in the
package summary for this example.
| Modifier and Type | Class and Description |
|---|---|
static class |
CountTableRows.Map
Nested class used to map input key/value pairs to a set of
intermediate key/value pairs in preparation for the reduce phase
of the associated MapReduce job.
|
static class |
CountTableRows.Reduce
Nested class used to reduce to a smaller set of values, the set of
intermediate values, sharing a key, which were produced by the
mapping phase of the job.
|
| Constructor and Description |
|---|
CountTableRows() |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] args) |
int |
run(String[] args) |
getConf, setConfclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetConf, setConfCopyright (c) 2011, 2015 Oracle and/or its affiliates. All rights reserved.