Class DataDrivenDBRecordReader<T extends DBWritable>
java.lang.Object
org.apache.hadoop.mapreduce.RecordReader<LongWritable,T>
org.apache.hadoop.mapreduce.lib.db.DBRecordReader<T>
org.apache.hadoop.mapreduce.lib.db.DataDrivenDBRecordReader<T>
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
MySQLDataDrivenDBRecordReader,OracleDataDrivenDBRecordReader
@Public
@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
ConstructorsConstructorDescriptionDataDrivenDBRecordReader(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
Modifier and TypeMethodDescriptionprotected StringReturns 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
-
Constructor Details
-
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 Details
-
getSelectQuery
Returns the query for selecting the records, subclasses can override this for custom behaviour.- Overrides:
getSelectQueryin classDBRecordReader<T extends DBWritable>
-