HADOOP-16147. Allow CopyListing sequence file keys and values to be more easily customized.
Author: Andrew Olson
(cherry picked from commit faba3591d3
)
This commit is contained in:
parent
397b63ad0b
commit
ade3af6ef2
|
@ -248,6 +248,29 @@ public abstract class CopyListing extends Configured {
|
||||||
return credentials;
|
return credentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the key for an entry in the copy listing sequence file.
|
||||||
|
* @param sourcePathRoot the root source path for determining the relative
|
||||||
|
* target path
|
||||||
|
* @param fileStatus the copy listing file status
|
||||||
|
* @return the key for the sequence file entry
|
||||||
|
*/
|
||||||
|
protected Text getFileListingKey(Path sourcePathRoot,
|
||||||
|
CopyListingFileStatus fileStatus) {
|
||||||
|
return new Text(DistCpUtils.getRelativePath(sourcePathRoot,
|
||||||
|
fileStatus.getPath()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value for an entry in the copy listing sequence file.
|
||||||
|
* @param fileStatus the copy listing file status
|
||||||
|
* @return the value for the sequence file entry
|
||||||
|
*/
|
||||||
|
protected CopyListingFileStatus getFileListingValue(
|
||||||
|
CopyListingFileStatus fileStatus) {
|
||||||
|
return fileStatus;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public Factory method with which the appropriate CopyListing implementation may be retrieved.
|
* Public Factory method with which the appropriate CopyListing implementation may be retrieved.
|
||||||
* @param configuration The input configuration.
|
* @param configuration The input configuration.
|
||||||
|
|
|
@ -718,8 +718,8 @@ public class SimpleCopyListing extends CopyListing {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fileListWriter.append(new Text(DistCpUtils.getRelativePath(sourcePathRoot,
|
fileListWriter.append(getFileListingKey(sourcePathRoot, fileStatus),
|
||||||
fileStatus.getPath())), fileStatus);
|
getFileListingValue(fileStatus));
|
||||||
fileListWriter.sync();
|
fileListWriter.sync();
|
||||||
|
|
||||||
if (!fileStatus.isDirectory()) {
|
if (!fileStatus.isDirectory()) {
|
||||||
|
|
Loading…
Reference in New Issue