This project has retired. For details please refer to its Attic page.
AvroPathPerKeyTarget (Apache Crunch 0.9.0 API)
Class AvroPathPerKeyTarget

  extended by
      extended by
All Implemented Interfaces:
MapReduceTarget, PathTarget, Target

public class AvroPathPerKeyTarget
extends FileTargetImpl

A Target that wraps AvroPathPerKeyOutputFormat to allow one file per key to be written as the output of a PTable<String, T>.

Note the restrictions that apply to the AvroPathPerKeyOutputFormat; in particular, it's a good idea to write out all of the records for the same key together within each partition of the data.

Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.crunch.Target
Field Summary
Fields inherited from class
Constructor Summary
AvroPathPerKeyTarget(org.apache.hadoop.fs.Path path)
AvroPathPerKeyTarget(org.apache.hadoop.fs.Path path, FileNamingScheme fileNamingScheme)
AvroPathPerKeyTarget(String path)
Method Summary
 boolean accept(OutputHandler handler, PType<?> ptype)
          Checks to see if this Target instance is compatible with the given PType.
 void configureForMapReduce(org.apache.hadoop.mapreduce.Job job, PType<?> ptype, org.apache.hadoop.fs.Path outputPath, String name)
 void handleOutputs(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path workingPath, int index)
          Handles moving the output data for this target from a temporary location on the filesystem to its target path at the end of a MapReduce job.
 String toString()
Methods inherited from class
asSourceTarget, configureForMapReduce, configureForMapReduce, equals, extractPartitionNumber, getConverter, getDestFile, getFileNamingScheme, getPath, getSourcePattern, getSuccessIndicator, handleExisting, hashCode, isCompatible, outputConf
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

Constructor Detail


public AvroPathPerKeyTarget(String path)


public AvroPathPerKeyTarget(org.apache.hadoop.fs.Path path)


public AvroPathPerKeyTarget(org.apache.hadoop.fs.Path path,
                            FileNamingScheme fileNamingScheme)
Method Detail


public boolean accept(OutputHandler handler,
                      PType<?> ptype)
Description copied from interface: Target
Checks to see if this Target instance is compatible with the given PType.

Specified by:
accept in interface Target
accept in class FileTargetImpl
handler - The OutputHandler that is managing the output for the job
ptype - The PType to check
True if this Target can write data in the form of the given PType, false otherwise


public void configureForMapReduce(org.apache.hadoop.mapreduce.Job job,
                                  PType<?> ptype,
                                  org.apache.hadoop.fs.Path outputPath,
                                  String name)
Specified by:
configureForMapReduce in interface MapReduceTarget
configureForMapReduce in class FileTargetImpl


public void handleOutputs(org.apache.hadoop.conf.Configuration conf,
                          org.apache.hadoop.fs.Path workingPath,
                          int index)
                   throws IOException
Description copied from interface: PathTarget
Handles moving the output data for this target from a temporary location on the filesystem to its target path at the end of a MapReduce job.

Specified by:
handleOutputs in interface PathTarget
handleOutputs in class FileTargetImpl
conf - The job Configuration
workingPath - The temp directory that contains the output of the job
index - The index of this target for jobs that write multiple output files to a single directory


public String toString()
toString in class FileTargetImpl

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