org.apache.gora.examples.mapreduce
Class QueryCounter<K,T extends Persistent>

java.lang.Object
  extended by org.apache.hadoop.conf.Configured
      extended by 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.


Nested Class Summary
static class QueryCounter.QueryCounterMapper<K,T extends Persistent>
           
 
Field Summary
static String COUNTER_GROUP
           
static String ROWS
           
 
Constructor Summary
QueryCounter(org.apache.hadoop.conf.Configuration conf)
           
 
Method Summary
 long countQuery(DataStore<K,T> dataStore)
          Returns the number of results to the Query obtained by the getQuery(DataStore) method.
 long countQuery(DataStore<K,T> dataStore, Query<K,T> query)
          Returns the number of results to the Query
 org.apache.hadoop.mapreduce.Job createJob(DataStore<K,T> dataStore, Query<K,T> query)
          Creates and returns the Job for submitting to Hadoop mapreduce.
 Query<K,T> getQuery(DataStore<K,T> dataStore)
          Returns the Query to count the results of.
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
 

Field Detail

COUNTER_GROUP

public static final String COUNTER_GROUP
See Also:
Constant Field Values

ROWS

public static final String ROWS
See Also:
Constant Field Values
Constructor Detail

QueryCounter

public QueryCounter(org.apache.hadoop.conf.Configuration conf)
Method Detail

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.