This project has retired. For details please refer to its Attic page.
DataBaseSource (Apache Crunch 0.7.0 API)

org.apache.crunch.contrib.io.jdbc
Class DataBaseSource<T extends org.apache.hadoop.mapreduce.lib.db.DBWritable & org.apache.hadoop.io.Writable>

java.lang.Object
  extended by org.apache.crunch.contrib.io.jdbc.DataBaseSource<T>
Type Parameters:
T - The input type of this source
All Implemented Interfaces:
Source<T>

public class DataBaseSource<T extends org.apache.hadoop.mapreduce.lib.db.DBWritable & org.apache.hadoop.io.Writable>
extends Object
implements Source<T>

Source from reading from a database via a JDBC connection. Underlying database reading is provided by DBInputFormat.

A type that is input via this class must be a Writable that also implements DBWritable. On the DBWritable.readFields(java.sql.ResultSet) method needs to be fully implemented form DBWritable.


Field Summary
 String countClause
           
 
Method Summary
 void configureSource(org.apache.hadoop.mapreduce.Job job, int inputId)
          Configure the given job to use this source as an input.
 Converter<?,?,?,?> getConverter()
          Returns the Converter used for mapping the inputs from this instance into PCollection or PTable values.
 long getLastModifiedAt(org.apache.hadoop.conf.Configuration configuration)
          Returns the time (in milliseconds) that this Source was most recently modified (e.g., because an input file was edited or new files were added to a directory.)
 long getSize(org.apache.hadoop.conf.Configuration configuration)
          Returns the number of bytes in this Source.
 PType<T> getType()
          Returns the PType for this source.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

countClause

public String countClause
Method Detail

configureSource

public void configureSource(org.apache.hadoop.mapreduce.Job job,
                            int inputId)
                     throws IOException
Description copied from interface: Source
Configure the given job to use this source as an input.

Specified by:
configureSource in interface Source<T extends org.apache.hadoop.mapreduce.lib.db.DBWritable & org.apache.hadoop.io.Writable>
Parameters:
job - The job to configure
inputId - For a multi-input job, an identifier for this input to the job
Throws:
IOException

getSize

public long getSize(org.apache.hadoop.conf.Configuration configuration)
Description copied from interface: Source
Returns the number of bytes in this Source.

Specified by:
getSize in interface Source<T extends org.apache.hadoop.mapreduce.lib.db.DBWritable & org.apache.hadoop.io.Writable>

getLastModifiedAt

public long getLastModifiedAt(org.apache.hadoop.conf.Configuration configuration)
Description copied from interface: Source
Returns the time (in milliseconds) that this Source was most recently modified (e.g., because an input file was edited or new files were added to a directory.)

Specified by:
getLastModifiedAt in interface Source<T extends org.apache.hadoop.mapreduce.lib.db.DBWritable & org.apache.hadoop.io.Writable>

getType

public PType<T> getType()
Description copied from interface: Source
Returns the PType for this source.

Specified by:
getType in interface Source<T extends org.apache.hadoop.mapreduce.lib.db.DBWritable & org.apache.hadoop.io.Writable>

getConverter

public Converter<?,?,?,?> getConverter()
Description copied from interface: Source
Returns the Converter used for mapping the inputs from this instance into PCollection or PTable values.

Specified by:
getConverter in interface Source<T extends org.apache.hadoop.mapreduce.lib.db.DBWritable & org.apache.hadoop.io.Writable>


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.