public class DelimitedPartition extends java.lang.Object implements Partition
Partition
interface that allows for simple
text delimited paths as partitions.
For example, given the delimiter -
(dash), a partition path will have dashes.
Note the delimiter must not be naturally present in any of the values making up the partition.
The postfix value will be appended to any partition when created, and removed when the partition is parsed. Use this value to add static filenames to the output path. It is safe to include the delimiter in the postfix value (e.g '/somepath/filename.csv' where the delimiter is the default '/').
Note some platforms do not allow for referencing files directly on write, only allowing for partitioning into directories where the actual filename is generated. In this case, if the postfix is intended to be a filename, it will be interpreted as a directory.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PATH_DELIM |
Constructor and Description |
---|
DelimitedPartition(Fields partitionFields) |
DelimitedPartition(Fields partitionFields,
java.lang.String delimiter) |
DelimitedPartition(Fields partitionFields,
java.lang.String delimiter,
java.lang.String postfix) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDelimiter() |
Fields |
getPartitionFields()
The
Fields used to populate the partition. |
int |
getPathDepth()
Returns the directory search depth of the partition.
|
protected java.util.regex.Pattern |
getPattern() |
java.lang.String |
getPostfix() |
java.lang.String |
toPartition(TupleEntry tupleEntry)
Converts the given tupleEntry into a partition string.
|
void |
toTuple(java.lang.String partition,
TupleEntry tupleEntry)
Converts the given partition String to a
TupleEntry using the given TupleEntry instance for re-use. |
public static final java.lang.String PATH_DELIM
public DelimitedPartition(Fields partitionFields)
public DelimitedPartition(Fields partitionFields, java.lang.String delimiter)
public DelimitedPartition(Fields partitionFields, java.lang.String delimiter, java.lang.String postfix)
public int getPathDepth()
Partition
For example, a Partition implementation that returns values like "2012/09/01"
would have a depth of 3.
getPathDepth
in interface Partition
public Fields getPartitionFields()
Partition
Fields
used to populate the partition.getPartitionFields
in interface Partition
protected java.util.regex.Pattern getPattern()
public java.lang.String getDelimiter()
public java.lang.String getPostfix()
public void toTuple(java.lang.String partition, TupleEntry tupleEntry)
Partition
TupleEntry
using the given TupleEntry instance for re-use.public java.lang.String toPartition(TupleEntry tupleEntry)
Partition
toPartition
in interface Partition
tupleEntry
- a TupleEntryCopyright © 2007-2017 Cascading Maintainers. All Rights Reserved.