|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.yale.cs.hadoopdb.connector.AbstractDBRecordReader
public abstract class AbstractDBRecordReader
Base DBRecordReader class. Several extensions of this class are possible to allow different constructors and SQL query specification through abstract method getSqlQuery(). Class implements all methods needed by a Hadoop's RecordReader interface except for next().
Field Summary | |
---|---|
protected java.sql.Connection |
connection
|
protected long |
connTime
|
static org.apache.commons.logging.Log |
LOG
|
static int |
MAX_CONNECTION_TRIALS
Maximum number of connection trials |
protected long |
pos
|
protected long |
queryTime
|
protected java.sql.ResultSet |
results
|
protected long |
startTime
|
protected java.sql.Statement |
statement
|
Constructor Summary | |
---|---|
AbstractDBRecordReader()
|
Method Summary | |
---|---|
void |
close()
After query execution is complete, the database connection is closed cleanly. |
org.apache.hadoop.io.LongWritable |
createKey()
|
protected java.sql.Connection |
getConnection(DBInputSplit dbSplit)
Connects to a database of a particular chunk (specified within the split). |
private static java.lang.String |
getLocatHostAddres()
Helper method to retrieve local host name or null if not possible |
long |
getPos()
Returns the number of rows retrieved so far. |
float |
getProgress()
Returns a float [0,1] indicating progress (currently, progress is always 0 as there is no easy way for progress estimation). |
protected abstract java.lang.String |
getSqlQuery()
Abstract method definition. |
protected void |
setupDB(DBInputSplit split,
org.apache.hadoop.mapred.JobConf conf)
Method sets up a connection to a database and provides query optimization parameters. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.sql.Connection connection
protected long connTime
public static final org.apache.commons.logging.Log LOG
public static final int MAX_CONNECTION_TRIALS
protected long pos
protected long queryTime
protected java.sql.ResultSet results
protected long startTime
protected java.sql.Statement statement
Constructor Detail |
---|
public AbstractDBRecordReader()
Method Detail |
---|
public void close() throws java.io.IOException
java.io.IOException
public org.apache.hadoop.io.LongWritable createKey()
protected java.sql.Connection getConnection(DBInputSplit dbSplit)
private static java.lang.String getLocatHostAddres()
public long getPos() throws java.io.IOException
java.io.IOException
public float getProgress() throws java.io.IOException
java.io.IOException
protected abstract java.lang.String getSqlQuery()
protected void setupDB(DBInputSplit split, org.apache.hadoop.mapred.JobConf conf) throws java.sql.SQLException
java.sql.SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |