org.apache.hadoop.mapreduce.lib.db
Class DataDrivenDBRecordReader<T extends DBWritable>

java.lang.Object
  extended by org.apache.hadoop.mapreduce.RecordReader<LongWritable,T>
      extended by org.apache.hadoop.mapreduce.lib.db.DBRecordReader<T>
          extended by org.apache.hadoop.mapreduce.lib.db.DataDrivenDBRecordReader<T>
All Implemented Interfaces:
Closeable
Direct Known Subclasses:
MySQLDataDrivenDBRecordReader, OracleDataDrivenDBRecordReader

@InterfaceAudience.Public
@InterfaceStability.Evolving
public class DataDrivenDBRecordReader<T extends DBWritable>
extends DBRecordReader<T>

A RecordReader that reads records from a SQL table, using data-driven WHERE clause splits. Emits LongWritables containing the record number as key and DBWritables as value.


Field Summary
 
Fields inherited from class org.apache.hadoop.mapreduce.lib.db.DBRecordReader
statement
 
Constructor Summary
DataDrivenDBRecordReader(org.apache.hadoop.mapreduce.lib.db.DBInputFormat.DBInputSplit split, Class<T> inputClass, Configuration conf, Connection conn, DBConfiguration dbConfig, String cond, String[] fields, String table, String dbProduct)
           
 
Method Summary
protected  String getSelectQuery()
          Returns the query for selecting the records, subclasses can override this for custom behaviour.
 
Methods inherited from class org.apache.hadoop.mapreduce.lib.db.DBRecordReader
close, createValue, executeQuery, getConditions, getConnection, getCurrentKey, getCurrentValue, getDBConf, getFieldNames, getPos, getProgress, getSplit, getStatement, getTableName, initialize, next, nextKeyValue, setStatement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataDrivenDBRecordReader

public DataDrivenDBRecordReader(org.apache.hadoop.mapreduce.lib.db.DBInputFormat.DBInputSplit split,
                                Class<T> inputClass,
                                Configuration conf,
                                Connection conn,
                                DBConfiguration dbConfig,
                                String cond,
                                String[] fields,
                                String table,
                                String dbProduct)
                         throws SQLException
Parameters:
split - The InputSplit to read data for
Throws:
SQLException
Method Detail

getSelectQuery

protected String getSelectQuery()
Returns the query for selecting the records, subclasses can override this for custom behaviour.

Overrides:
getSelectQuery in class DBRecordReader<T extends DBWritable>


Copyright © 2012 Apache Software Foundation. All Rights Reserved.