Skip to content

HADOOP-16147: Allow CopyListing sequence file keys and values to be m… #517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,29 @@ protected Credentials getCredentials() {
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.
* @param configuration The input configuration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -718,8 +718,8 @@ private void writeToFileListing(SequenceFile.Writer fileListWriter,
return;
}

fileListWriter.append(new Text(DistCpUtils.getRelativePath(sourcePathRoot,
fileStatus.getPath())), fileStatus);
fileListWriter.append(getFileListingKey(sourcePathRoot, fileStatus),
getFileListingValue(fileStatus));
fileListWriter.sync();

if (!fileStatus.isDirectory()) {
Expand Down