org.apache.hadoop.mapreduce.lib.db
Class OracleDBRecordReader<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.OracleDBRecordReader<T>
All Implemented Interfaces:
Closeable

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

A RecordReader that reads records from an Oracle SQL table.


Field Summary
static String SESSION_TIMEZONE_KEY
          Configuration key to set to a timezone string.
 
Fields inherited from class org.apache.hadoop.mapreduce.lib.db.DBRecordReader
statement
 
Constructor Summary
OracleDBRecordReader(org.apache.hadoop.mapreduce.lib.db.DBInputFormat.DBInputSplit split, Class<T> inputClass, Configuration conf, Connection conn, DBConfiguration dbConfig, String cond, String[] fields, String table)
           
 
Method Summary
protected  String getSelectQuery()
          Returns the query for selecting the records from an Oracle DB.
static void setSessionTimeZone(Configuration conf, Connection conn)
          Set session time zone
 
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
 

Field Detail

SESSION_TIMEZONE_KEY

public static final String SESSION_TIMEZONE_KEY
Configuration key to set to a timezone string.

See Also:
Constant Field Values
Constructor Detail

OracleDBRecordReader

public OracleDBRecordReader(org.apache.hadoop.mapreduce.lib.db.DBInputFormat.DBInputSplit split,
                            Class<T> inputClass,
                            Configuration conf,
                            Connection conn,
                            DBConfiguration dbConfig,
                            String cond,
                            String[] fields,
                            String table)
                     throws SQLException
Throws:
SQLException
Method Detail

getSelectQuery

protected String getSelectQuery()
Returns the query for selecting the records from an Oracle DB.

Overrides:
getSelectQuery in class DBRecordReader<T extends DBWritable>

setSessionTimeZone

public static void setSessionTimeZone(Configuration conf,
                                      Connection conn)
                               throws SQLException
Set session time zone

Parameters:
conf - The current configuration. We read the 'oracle.sessionTimeZone' property from here.
conn - The connection to alter the timezone properties of.
Throws:
SQLException


Copyright © 2014 Apache Software Foundation. All Rights Reserved.