HADOOP-11318. Update the document for hadoop fs -stat

This commit is contained in:
Akira Ajisaka 2015-01-16 00:55:20 +09:00
parent ce0117636a
commit ce29074685
4 changed files with 51 additions and 19 deletions

View File

@ -499,6 +499,8 @@ Release 2.7.0 - UNRELEASED
BUG FIXES BUG FIXES
HADOOP-11318. Update the document for hadoop fs -stat (aajisaka)
HADOOP 11400. GraphiteSink does not reconnect to Graphite after 'broken pipe' HADOOP 11400. GraphiteSink does not reconnect to Graphite after 'broken pipe'
(Kamil Gorlo via raviprak) (Kamil Gorlo via raviprak)

View File

@ -30,15 +30,17 @@
/** /**
* Print statistics about path in specified format. * Print statistics about path in specified format.
* Format sequences: * Format sequences:<br>
* %b: Size of file in blocks * %b: Size of file in blocks<br>
* %g: Group name of owner * %F: Type<br>
* %n: Filename * %g: Group name of owner<br>
* %o: Block size * %n: Filename<br>
* %r: replication * %o: Block size<br>
* %u: User name of owner * %r: replication<br>
* %y: UTC date as &quot;yyyy-MM-dd HH:mm:ss&quot; * %u: User name of owner<br>
* %Y: Milliseconds since January 1, 1970 UTC * %y: UTC date as &quot;yyyy-MM-dd HH:mm:ss&quot;<br>
* %Y: Milliseconds since January 1, 1970 UTC<br>
* If the format is not specified, %y is used by default.
*/ */
@InterfaceAudience.Private @InterfaceAudience.Private
@InterfaceStability.Unstable @InterfaceStability.Unstable
@ -48,12 +50,19 @@ public static void registerCommands(CommandFactory factory) {
factory.addClass(Stat.class, "-stat"); factory.addClass(Stat.class, "-stat");
} }
private static final String NEWLINE = System.getProperty("line.separator");
public static final String NAME = "stat"; public static final String NAME = "stat";
public static final String USAGE = "[format] <path> ..."; public static final String USAGE = "[format] <path> ...";
public static final String DESCRIPTION = public static final String DESCRIPTION =
"Print statistics about the file/directory at <path> " + "Print statistics about the file/directory at <path>" + NEWLINE +
"in the specified format. Format accepts filesize in blocks (%b), group name of owner(%g), " + "in the specified format. Format accepts filesize in" + NEWLINE +
"filename (%n), block size (%o), replication (%r), user name of owner(%u), modification date (%y, %Y)\n"; "blocks (%b), type (%F), group name of owner (%g)," + NEWLINE +
"name (%n), block size (%o), replication (%r), user name" + NEWLINE +
"of owner (%u), modification date (%y, %Y)." + NEWLINE +
"%y shows UTC date as \"yyyy-MM-dd HH:mm:ss\" and" + NEWLINE +
"%Y shows milliseconds since January 1, 1970 UTC." + NEWLINE +
"If the format is not specified, %y is used by default." + NEWLINE;
protected final SimpleDateFormat timeFmt; protected final SimpleDateFormat timeFmt;
{ {

View File

@ -665,13 +665,18 @@ permissions userid groupid modification_date modification_time dirname
* stat * stat
Usage: <<<hadoop fs -stat URI [URI ...]>>> Usage: <<<hadoop fs -stat [format] \<path\> ...>>>
Returns the stat information on the path. Print statistics about the file/directory at \<path\> in the specified
format. Format accepts filesize in blocks (%b), type (%F), group name of
owner (%g), name (%n), block size (%o), replication (%r), user name of
owner(%u), and modification date (%y, %Y). %y shows UTC date as
"yyyy-MM-dd HH:mm:ss" and %Y shows milliseconds since January 1, 1970 UTC.
If the format is not specified, %y is used by default.
Example: Example:
* <<<hadoop fs -stat path>>> * <<<hadoop fs -stat "%F %u:%g %b %y %n" /file>>>
Exit Code: Exit Code:
Returns 0 on success and -1 on error. Returns 0 on success and -1 on error.

View File

@ -786,19 +786,35 @@
</comparator> </comparator>
<comparator> <comparator>
<type>RegexpComparator</type> <type>RegexpComparator</type>
<expected-output>^( |\t)*Print statistics about the file/directory at &lt;path&gt; in the specified format.( )*</expected-output> <expected-output>^( |\t)*Print statistics about the file/directory at &lt;path&gt;( )*</expected-output>
</comparator> </comparator>
<comparator> <comparator>
<type>RegexpComparator</type> <type>RegexpComparator</type>
<expected-output>^( |\t)*Format accepts filesize in blocks \(%b\), group name of owner\(%g\), filename \(%n\),( )*</expected-output> <expected-output>^( |\t)*in the specified format. Format accepts filesize in( )*</expected-output>
</comparator> </comparator>
<comparator> <comparator>
<type>RegexpComparator</type> <type>RegexpComparator</type>
<expected-output>^( |\t)*block size \(%o\), replication \(%r\), user name of owner\(%u\), modification date( )*</expected-output> <expected-output>^( |\t)*blocks \(%b\), type \(%F\), group name of owner \(%g\),( )*</expected-output>
</comparator> </comparator>
<comparator> <comparator>
<type>RegexpComparator</type> <type>RegexpComparator</type>
<expected-output>^( |\t)*\(%y, %Y\)( )*</expected-output> <expected-output>^( |\t)*name \(%n\), block size \(%o\), replication \(%r\), user name( )*</expected-output>
</comparator>
<comparator>
<type>RegexpComparator</type>
<expected-output>^( |\t)*of owner \(%u\), modification date \(%y, %Y\).( )*</expected-output>
</comparator>
<comparator>
<type>RegexpComparator</type>
<expected-output>^( |\t)*%y shows UTC date as "yyyy-MM-dd HH:mm:ss" and( )*</expected-output>
</comparator>
<comparator>
<type>RegexpComparator</type>
<expected-output>^( |\t)*%Y shows milliseconds since January 1, 1970 UTC.( )*</expected-output>
</comparator>
<comparator>
<type>RegexpComparator</type>
<expected-output>^( |\t)*If the format is not specified, %y is used by default.( )*</expected-output>
</comparator> </comparator>
</comparators> </comparators>
</test> </test>