[
https://issues.apache.org/jira/browse/HADOOP-10798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14060955#comment-14060955
]
Colin Patrick McCabe commented on HADOOP-10798:
-----------------------------------------------
[~daryn]: smart. I was wondering why it worked on HDFS but not on localFS.
I don't know how I feel about this JIRA. The obvious solution is to have
localFS sort its output on Linux, but this will cripple performance by forcing
us to buffer the whole list of files before we return anything (in addition to
the cost of the sort itself, of course).
It would be a bit easier to do in globStatus, since we always have an array
there (unlike in listStatus where we might just have an iterator), but the same
issues crop up. We're slowing stuff down, for a feature most don't need.
Do users really depend on this behavior, or can we just drop this from the
spec? I guess the shell probably wants sorted output, to provide a consistent
display. But it can sort it itself, of course. Thoughts?
> globStatus() does not return sorted list of files
> -------------------------------------------------
>
> Key: HADOOP-10798
> URL: https://issues.apache.org/jira/browse/HADOOP-10798
> Project: Hadoop Common
> Issue Type: Bug
> Affects Versions: 2.3.0
> Reporter: Felix Borchers
> Priority: Minor
>
> (FileSystem) globStatus() does not return a sorted file list anymore.
> But the API says: " ... Results are sorted by their names."
> Seems to be lost, when the Globber Object was introduced. Can't find a sort
> in actual code.
> code to check this behavior:
> {code}
> Configuration conf = new Configuration();
> FileSystem fs = FileSystem.get(conf);
> Path path = new Path("/tmp/" + System.currentTimeMillis());
> fs.mkdirs(path);
> fs.deleteOnExit(path);
> fs.createNewFile(new Path(path, "2"));
> fs.createNewFile(new Path(path, "3"));
> fs.createNewFile(new Path(path, "1"));
> FileStatus[] status = fs.globStatus(new Path(path, "*"));
> Collection list = new ArrayList();
> for (FileStatus f: status) {
> list.add(f.getPath().toString());
> //System.out.println(f.getPath().toString());
> }
> boolean sorted = Ordering.natural().isOrdered(list);
> Assert.assertTrue(sorted);
> {code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)