|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cascading.tap.Tap cascading.tap.SinkTap cascading.tap.TemplateTap
public class TemplateTap
Class TemplateTap can be used to write tuple streams out to subdirectories based on the values in the Tuple
instance.
Hfs
Tap
and a Formatter
format syntax String. This allows
Tuple values at given positions to be used as directory names. Note that Hadoop can only sink to directories, and
all files in those directories are "part-xxxxx" files.
openTapsThreshold
limits the number of open files to be output to. This value defaults to 300 files.
Each time the threshold is exceeded, 10% of the least recently used open files will be closed.
Nested Class Summary | |
---|---|
static class |
TemplateTap.TemplateScheme
|
Constructor Summary | |
---|---|
TemplateTap(Hfs parent,
String pathTemplate)
Constructor TemplateTap creates a new TemplateTap instance using the given parent Hfs Tap as the
base path and default Scheme , and the pathTemplate as the Formatter format String. |
|
TemplateTap(Hfs parent,
String pathTemplate,
Fields pathFields)
Constructor TemplateTap creates a new TemplateTap instance using the given parent Hfs Tap as the
base path and default Scheme , and the pathTemplate as the Formatter format String. |
|
TemplateTap(Hfs parent,
String pathTemplate,
Fields pathFields,
int openTapsThreshold)
Constructor TemplateTap creates a new TemplateTap instance using the given parent Hfs Tap as the
base path and default Scheme , and the pathTemplate as the Formatter format String. |
|
TemplateTap(Hfs parent,
String pathTemplate,
Fields pathFields,
SinkMode sinkMode)
Constructor TemplateTap creates a new TemplateTap instance using the given parent Hfs Tap as the
base path and default Scheme , and the pathTemplate as the Formatter format String. |
|
TemplateTap(Hfs parent,
String pathTemplate,
Fields pathFields,
SinkMode sinkMode,
boolean keepParentOnDelete)
Constructor TemplateTap creates a new TemplateTap instance using the given parent Hfs Tap as the
base path and default Scheme , and the pathTemplate as the Formatter format String. |
|
TemplateTap(Hfs parent,
String pathTemplate,
Fields pathFields,
SinkMode sinkMode,
boolean keepParentOnDelete,
int openTapsThreshold)
/** Constructor TemplateTap creates a new TemplateTap instance using the given parent Hfs Tap as the
base path and default Scheme , and the pathTemplate as the Formatter format String. |
|
TemplateTap(Hfs parent,
String pathTemplate,
int openTapsThreshold)
Constructor TemplateTap creates a new TemplateTap instance using the given parent Hfs Tap as the
base path and default Scheme , and the pathTemplate as the Formatter format String. |
|
TemplateTap(Hfs parent,
String pathTemplate,
SinkMode sinkMode)
Constructor TemplateTap creates a new TemplateTap instance using the given parent Hfs Tap as the
base path and default Scheme , and the pathTemplate as the Formatter format String. |
|
TemplateTap(Hfs parent,
String pathTemplate,
SinkMode sinkMode,
boolean keepParentOnDelete)
Constructor TemplateTap creates a new TemplateTap instance using the given parent Hfs Tap as the
base path and default Scheme , and the pathTemplate as the Formatter format String. |
|
TemplateTap(Hfs parent,
String pathTemplate,
SinkMode sinkMode,
boolean keepParentOnDelete,
int openTapsThreshold)
Constructor TemplateTap creates a new TemplateTap instance using the given parent Hfs Tap as the
base path and default Scheme , and the pathTemplate as the Formatter format String. |
Method Summary | |
---|---|
boolean |
deletePath(JobConf conf)
Method deletePath deletes the resource represented by this instance. |
boolean |
equals(Object object)
|
int |
getOpenTapsThreshold()
Method getOpenTapsThreshold returns the openTapsThreshold of this TemplateTap object. |
Tap |
getParent()
Method getParent returns the parent Tap of this TemplateTap object. |
Path |
getPath()
Method getPath returns the Hadoop path to the resource represented by this Tap instance. |
long |
getPathModified(JobConf conf)
Method getPathModified returns the date this resource was last modified. |
String |
getPathTemplate()
Method getPathTemplate returns the pathTemplate Formatter format String of this TemplateTap object. |
int |
hashCode()
|
boolean |
isWriteDirect()
Method isWriteDirect returns true if this instances TupleEntryCollector should be used to sink values. |
boolean |
makeDirs(JobConf conf)
Method makeDirs makes all the directories this Tap instance represents. |
TupleEntryCollector |
openForWrite(JobConf conf)
Method openForWrite opens the resource represented by this Tap instance. |
boolean |
pathExists(JobConf conf)
Method pathExists return true if the path represented by this instance exists. |
String |
toString()
|
Methods inherited from class cascading.tap.SinkTap |
---|
getSourceFields, isSource, openForRead, source, sourceInit |
Methods inherited from class cascading.tap.Tap |
---|
flowInit, getIdentifier, getQualifiedPath, getScheme, getSinkFields, getSinkMode, isAppend, isEquivalentTo, isKeep, isReplace, isSink, isUpdate, outgoingScopeFor, resolveFields, resolveIncomingOperationFields, setScheme, setWriteDirect, sink, sinkInit, taps |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
@ConstructorProperties(value={"parent","pathTemplate"}) public TemplateTap(Hfs parent, String pathTemplate)
Hfs
Tap as the
base path and default Scheme
, and the pathTemplate as the Formatter
format String.
parent
- of type TappathTemplate
- of type String@ConstructorProperties(value={"parent","pathTemplate","openTapsThreshold"}) public TemplateTap(Hfs parent, String pathTemplate, int openTapsThreshold)
Hfs
Tap as the
base path and default Scheme
, and the pathTemplate as the Formatter
format String.
openTapsThreshold limits the number of open files to be output to.
parent
- of type HfspathTemplate
- of type StringopenTapsThreshold
- of type int@ConstructorProperties(value={"parent","pathTemplate","sinkMode"}) public TemplateTap(Hfs parent, String pathTemplate, SinkMode sinkMode)
Hfs
Tap as the
base path and default Scheme
, and the pathTemplate as the Formatter
format String.
parent
- of type TappathTemplate
- of type StringsinkMode
- of type SinkMode@ConstructorProperties(value={"parent","pathTemplate","sinkMode","keepParentOnDelete"}) public TemplateTap(Hfs parent, String pathTemplate, SinkMode sinkMode, boolean keepParentOnDelete)
Hfs
Tap as the
base path and default Scheme
, and the pathTemplate as the Formatter
format String.
keepParentOnDelete, when set to true, prevents the parent Tap from being deleted when deletePath(org.apache.hadoop.mapred.JobConf)
is called, typically an issue when used inside a Cascade
.
parent
- of type TappathTemplate
- of type StringsinkMode
- of type SinkModekeepParentOnDelete
- of type boolean@ConstructorProperties(value={"parent","pathTemplate","sinkMode","keepParentOnDelete","openTapsThreshold"}) public TemplateTap(Hfs parent, String pathTemplate, SinkMode sinkMode, boolean keepParentOnDelete, int openTapsThreshold)
Hfs
Tap as the
base path and default Scheme
, and the pathTemplate as the Formatter
format String.
keepParentOnDelete, when set to true, prevents the parent Tap from being deleted when deletePath(org.apache.hadoop.mapred.JobConf)
is called, typically an issue when used inside a Cascade
.
openTapsThreshold limits the number of open files to be output to.
parent
- of type TappathTemplate
- of type StringsinkMode
- of type SinkModekeepParentOnDelete
- of type booleanopenTapsThreshold
- of type int@ConstructorProperties(value={"parent","pathTemplate","pathFields"}) public TemplateTap(Hfs parent, String pathTemplate, Fields pathFields)
Hfs
Tap as the
base path and default Scheme
, and the pathTemplate as the Formatter
format String.
The pathFields is a selector that selects and orders the fields to be used in the given pathTemplate.
This constructor also allows the sinkFields of the parent Tap to be independent of the pathFields. Thus allowing
data not in the result file to be used in the template path name.
parent
- of type TappathTemplate
- of type StringpathFields
- of type Fields@ConstructorProperties(value={"parent","pathTemplate","pathFields","openTapsThreshold"}) public TemplateTap(Hfs parent, String pathTemplate, Fields pathFields, int openTapsThreshold)
Hfs
Tap as the
base path and default Scheme
, and the pathTemplate as the Formatter
format String.
The pathFields is a selector that selects and orders the fields to be used in the given pathTemplate.
This constructor also allows the sinkFields of the parent Tap to be independent of the pathFields. Thus allowing
data not in the result file to be used in the template path name.
openTapsThreshold limits the number of open files to be output to.
parent
- of type HfspathTemplate
- of type StringpathFields
- of type FieldsopenTapsThreshold
- of type int@ConstructorProperties(value={"parent","pathTemplate","pathFields","sinkMode"}) public TemplateTap(Hfs parent, String pathTemplate, Fields pathFields, SinkMode sinkMode)
Hfs
Tap as the
base path and default Scheme
, and the pathTemplate as the Formatter
format String.
The pathFields is a selector that selects and orders the fields to be used in the given pathTemplate.
This constructor also allows the sinkFields of the parent Tap to be independent of the pathFields. Thus allowing
data not in the result file to be used in the template path name.
parent
- of type TappathTemplate
- of type StringpathFields
- of type FieldssinkMode
- of type SinkMode@ConstructorProperties(value={"parent","pathTemplate","pathFields","sinkMode","keepParentOnDelete"}) public TemplateTap(Hfs parent, String pathTemplate, Fields pathFields, SinkMode sinkMode, boolean keepParentOnDelete)
Hfs
Tap as the
base path and default Scheme
, and the pathTemplate as the Formatter
format String.
The pathFields is a selector that selects and orders the fields to be used in the given pathTemplate.
This constructor also allows the sinkFields of the parent Tap to be independent of the pathFields. Thus allowing
data not in the result file to be used in the template path name.
keepParentOnDelete, when set to true, prevents the parent Tap from being deleted when deletePath(org.apache.hadoop.mapred.JobConf)
is called, typically an issue when used inside a Cascade
.
parent
- of type TappathTemplate
- of type StringpathFields
- of type FieldssinkMode
- of type SinkModekeepParentOnDelete
- of type boolean@ConstructorProperties(value={"parent","pathTemplate","pathFields","sinkMode","keepParentOnDelete","openTapsThreshold"}) public TemplateTap(Hfs parent, String pathTemplate, Fields pathFields, SinkMode sinkMode, boolean keepParentOnDelete, int openTapsThreshold)
Hfs
Tap as the
base path and default Scheme
, and the pathTemplate as the Formatter
format String.
The pathFields is a selector that selects and orders the fields to be used in the given pathTemplate.
This constructor also allows the sinkFields of the parent Tap to be independent of the pathFields. Thus allowing
data not in the result file to be used in the template path name.
keepParentOnDelete, when set to true, prevents the parent Tap from being deleted when deletePath(org.apache.hadoop.mapred.JobConf)
is called, typically an issue when used inside a Cascade
.
openTapsThreshold limits the number of open files to be output to.
parent
- of type HfspathTemplate
- of type StringpathFields
- of type FieldssinkMode
- of type SinkModekeepParentOnDelete
- of type booleanopenTapsThreshold
- of type intMethod Detail |
---|
public Tap getParent()
public String getPathTemplate()
Formatter
format String of this TemplateTap object.
public boolean isWriteDirect()
Tap
TupleEntryCollector
should be used to sink values.
isWriteDirect
in class Tap
public Path getPath()
Tap
getPath
in class Tap
Tap.getPath()
public int getOpenTapsThreshold()
public TupleEntryCollector openForWrite(JobConf conf) throws IOException
Tap
openForWrite
in class SinkTap
conf
- of type JobConf
IOException
- whenpublic boolean makeDirs(JobConf conf) throws IOException
Tap
makeDirs
in class Tap
conf
- of type JobConf
IOException
- when there is an error making directoriesTap.makeDirs(JobConf)
public boolean deletePath(JobConf conf) throws IOException
Tap
deletePath
in class Tap
conf
- of type JobConf
IOException
- when the resource cannot be deletedTap.deletePath(JobConf)
public boolean pathExists(JobConf conf) throws IOException
Tap
pathExists
in class Tap
conf
- of type JobConf
IOException
- when the status cannot be determinedTap.pathExists(JobConf)
public long getPathModified(JobConf conf) throws IOException
Tap
getPathModified
in class Tap
conf
- of type JobConf
IOException
- when the modified date cannot be determinedTap.getPathModified(JobConf)
public boolean equals(Object object)
equals
in class Tap
public int hashCode()
hashCode
in class Tap
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |