org.apache.gora.examples.mapreduce
Class QueryCounter<K,T extends Persistent>
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.gora.examples.mapreduce.QueryCounter<K,T>
- All Implemented Interfaces:
- org.apache.hadoop.conf.Configurable, org.apache.hadoop.util.Tool
public class QueryCounter<K,T extends Persistent>
- extends org.apache.hadoop.conf.Configured
- implements org.apache.hadoop.util.Tool
Example Hadoop job to count the row of a gora Query
.
Constructor Summary |
QueryCounter(org.apache.hadoop.conf.Configuration conf)
|
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 |
COUNTER_GROUP
public static final String COUNTER_GROUP
- See Also:
- Constant Field Values
ROWS
public static final String ROWS
- See Also:
- Constant Field Values
QueryCounter
public QueryCounter(org.apache.hadoop.conf.Configuration conf)
getQuery
public Query<K,T> getQuery(DataStore<K,T> dataStore)
- Returns the Query to count the results of. Subclasses can
override this function to customize the query.
- Returns:
- the Query object to count the results of.
createJob
public org.apache.hadoop.mapreduce.Job createJob(DataStore<K,T> dataStore,
Query<K,T> query)
throws IOException
- Creates and returns the
Job
for submitting to Hadoop mapreduce.
- Parameters:
dataStore
- query
-
- Returns:
-
- Throws:
IOException
countQuery
public long countQuery(DataStore<K,T> dataStore,
Query<K,T> query)
throws Exception
- Returns the number of results to the Query
- Throws:
Exception
countQuery
public long countQuery(DataStore<K,T> dataStore)
throws Exception
- Returns the number of results to the Query obtained by the
getQuery(DataStore)
method.
- Throws:
Exception
run
public int run(String[] args)
throws Exception
- Specified by:
run
in interface org.apache.hadoop.util.Tool
- Throws:
Exception
main
public static void main(String[] args)
throws Exception
- Throws:
Exception
Copyright © 2010-2013 The Apache Software Foundation. All Rights Reserved.