hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hadoop QA (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-14477) FileSystem Simplify / Optimize listStatus Method
Date Thu, 01 Jun 2017 21:58:04 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-14477?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16033779#comment-16033779
] 

Hadoop QA commented on HADOOP-14477:
------------------------------------

| (x) *{color:red}-1 overall{color}* |
\\
\\
|| Vote || Subsystem || Runtime || Comment ||
| {color:blue}0{color} | {color:blue} reexec {color} | {color:blue}  0m  0s{color} | {color:blue}
Docker mode activated. {color} |
| {color:red}-1{color} | {color:red} patch {color} | {color:red}  0m  4s{color} | {color:red}
HADOOP-14477 does not apply to trunk. Rebase required? Wrong Branch? See https://wiki.apache.org/hadoop/HowToContribute
for help. {color} |
\\
\\
|| Subsystem || Report/Notes ||
| JIRA Issue | HADOOP-14477 |
| JIRA Patch URL | https://issues.apache.org/jira/secure/attachment/12870864/HADOOP-14477.1.patch
|
| Console output | https://builds.apache.org/job/PreCommit-HADOOP-Build/12428/console |
| Powered by | Apache Yetus 0.5.0-SNAPSHOT   http://yetus.apache.org |


This message was automatically generated.



> FileSystem Simplify / Optimize listStatus Method
> ------------------------------------------------
>
>                 Key: HADOOP-14477
>                 URL: https://issues.apache.org/jira/browse/HADOOP-14477
>             Project: Hadoop Common
>          Issue Type: Improvement
>    Affects Versions: 2.7.3, 3.0.0-alpha3
>            Reporter: BELUGA BEHR
>            Priority: Minor
>         Attachments: HADOOP-14477.1.patch
>
>
> {code:title=org.apache.hadoop.fs.FileSystem.listStatus(ArrayList<FileStatus>, Path,
PathFilter)}
>   /*
>    * Filter files/directories in the given path using the user-supplied path
>    * filter. Results are added to the given array <code>results</code>.
>    */
>   private void listStatus(ArrayList<FileStatus> results, Path f,
>       PathFilter filter) throws FileNotFoundException, IOException {
>     FileStatus listing[] = listStatus(f);
>     if (listing == null) {
>       throw new IOException("Error accessing " + f);
>     }
>     for (int i = 0; i < listing.length; i++) {
>       if (filter.accept(listing[i].getPath())) {
>         results.add(listing[i]);
>       }
>     }
>   }
> {code}
> {code:title=org.apache.hadoop.fs.FileSystem.listStatus(Path, PathFilter)}
>   public FileStatus[] listStatus(Path f, PathFilter filter) 
>                                    throws FileNotFoundException, IOException {
>     ArrayList<FileStatus> results = new ArrayList<FileStatus>();
>     listStatus(results, f, filter);
>     return results.toArray(new FileStatus[results.size()]);
>   }
> {code}
> We can be smarter about this:
> # Use enhanced for-loops
> # Optimize for the case where there are zero files in a directory, save on object instantiation
> # More encapsulated design



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Mime
View raw message