This project has retired. For details please refer to its Attic page.
DataBaseSource (Apache Crunch 0.9.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.io.impl.FileSourceImpl<T>
      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 FileSourceImpl<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
 
Fields inherited from class org.apache.crunch.io.impl.FileSourceImpl
inputBundle, path, paths, ptype
 
Method Summary
 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.
 
Methods inherited from class org.apache.crunch.io.impl.FileSourceImpl
configureSource, equals, getBundle, getConverter, getPath, getPaths, getType, hashCode, inputConf, pathsAsString, read, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

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>
Overrides:
getSize in class FileSourceImpl<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>
Overrides:
getLastModifiedAt in class FileSourceImpl<T extends org.apache.hadoop.mapreduce.lib.db.DBWritable & org.apache.hadoop.io.Writable>


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