HADOOP-7348. Change 'addnl' in getmerge util to be a flag '-nl' instead (XieXianshan via harsh)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1225192 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a9ffbdd0d7
commit
1e0c51c66e
@ -79,6 +79,8 @@ Trunk (unreleased changes)
|
|||||||
|
|
||||||
HADOOP-7574. Improve FSShell -stat, add user/group elements (XieXianshan via harsh)
|
HADOOP-7574. Improve FSShell -stat, add user/group elements (XieXianshan via harsh)
|
||||||
|
|
||||||
|
HADOOP-7348. Change 'addnl' in getmerge util to be a flag '-nl' instead (XieXianshan via harsh)
|
||||||
|
|
||||||
BUGS
|
BUGS
|
||||||
|
|
||||||
HADOOP-7851. Configuration.getClasses() never returns the default value.
|
HADOOP-7851. Configuration.getClasses() never returns the default value.
|
||||||
|
@ -260,11 +260,11 @@
|
|||||||
<section>
|
<section>
|
||||||
<title> getmerge </title>
|
<title> getmerge </title>
|
||||||
<p>
|
<p>
|
||||||
<code>Usage: hdfs dfs -getmerge <src> <localdst> [addnl]</code>
|
<code>Usage: hdfs dfs -getmerge [-nl] <src> <localdst></code>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Takes a source directory and a destination file as input and concatenates files in src into the destination local file.
|
Takes a source directory and a destination file as input and concatenates files in src into the destination local file.
|
||||||
Optionally <code>addnl</code> can be set to enable adding a newline character at the end of each file.
|
Optionally <code>-nl</code> flag can be set to enable adding a newline character at the end of each file during merge.
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
@ -45,26 +45,22 @@ public static void registerCommands(CommandFactory factory) {
|
|||||||
/** merge multiple files together */
|
/** merge multiple files together */
|
||||||
public static class Merge extends FsCommand {
|
public static class Merge extends FsCommand {
|
||||||
public static final String NAME = "getmerge";
|
public static final String NAME = "getmerge";
|
||||||
public static final String USAGE = "<src> <localdst> [addnl]";
|
public static final String USAGE = "[-nl] <src> <localdst>";
|
||||||
public static final String DESCRIPTION =
|
public static final String DESCRIPTION =
|
||||||
"Get all the files in the directories that\n" +
|
"Get all the files in the directories that\n" +
|
||||||
"match the source file pattern and merge and sort them to only\n" +
|
"match the source file pattern and merge and sort them to only\n" +
|
||||||
"one file on local fs. <src> is kept.";
|
"one file on local fs. <src> is kept.\n" +
|
||||||
|
" -nl Add a newline character at the end of each file.";
|
||||||
|
|
||||||
protected PathData dst = null;
|
protected PathData dst = null;
|
||||||
protected String delimiter = null;
|
protected String delimiter = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void processOptions(LinkedList<String> args) throws IOException {
|
protected void processOptions(LinkedList<String> args) throws IOException {
|
||||||
CommandFormat cf = new CommandFormat(2, 3);
|
CommandFormat cf = new CommandFormat(2, 3, "nl");
|
||||||
cf.parse(args);
|
cf.parse(args);
|
||||||
|
|
||||||
// TODO: this really should be a -nl option
|
delimiter = cf.getOpt("nl") ? "\n" : null;
|
||||||
if ((args.size() > 2) && Boolean.parseBoolean(args.removeLast())) {
|
|
||||||
delimiter = "\n";
|
|
||||||
} else {
|
|
||||||
delimiter = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
dst = new PathData(new File(args.removeLast()), getConf());
|
dst = new PathData(new File(args.removeLast()), getConf());
|
||||||
}
|
}
|
||||||
|
@ -449,7 +449,7 @@
|
|||||||
<comparators>
|
<comparators>
|
||||||
<comparator>
|
<comparator>
|
||||||
<type>RegexpComparator</type>
|
<type>RegexpComparator</type>
|
||||||
<expected-output>^-getmerge <src> <localdst> \[addnl\]:( |\t)*Get all the files in the directories that( )*</expected-output>
|
<expected-output>^-getmerge \[-nl\] <src> <localdst>:( |\t)*Get all the files in the directories that( )*</expected-output>
|
||||||
</comparator>
|
</comparator>
|
||||||
<comparator>
|
<comparator>
|
||||||
<type>RegexpComparator</type>
|
<type>RegexpComparator</type>
|
||||||
@ -459,6 +459,10 @@
|
|||||||
<type>RegexpComparator</type>
|
<type>RegexpComparator</type>
|
||||||
<expected-output>^( |\t)*one file on local fs. <src> is kept.( )*</expected-output>
|
<expected-output>^( |\t)*one file on local fs. <src> is kept.( )*</expected-output>
|
||||||
</comparator>
|
</comparator>
|
||||||
|
<comparator>
|
||||||
|
<type>RegexpComparator</type>
|
||||||
|
<expected-output>^( |\t)*-nl Add a newline character at the end of each file.( )*</expected-output>
|
||||||
|
</comparator>
|
||||||
</comparators>
|
</comparators>
|
||||||
</test>
|
</test>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user