[
https://issues.apache.org/jira/browse/HDFS-2461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13707494#comment-13707494
]
Colin Patrick McCabe commented on HDFS-2461:
--------------------------------------------
there is already a libc method called fnmatch which does what you want.
{code}
NAME
fnmatch - match filename or pathname
SYNOPSIS
#include <fnmatch.h>
int fnmatch(const char *pattern, const char *string, int flags);
DESCRIPTION
The fnmatch() function checks whether the string argument matches the
pattern argument, which is a shell wildcard pattern.
{code}
As far as I can tell, the {{org.apache.hadoop.fs.FileSystem#globStatus}} does
everything client-side (there is no support for server-side globs-- correct me
if I'm wrong) so there is no point in duplicating libc functionality in libhdfs.
> Support HDFS file name globbing in libhdfs
> ------------------------------------------
>
> Key: HDFS-2461
> URL: https://issues.apache.org/jira/browse/HDFS-2461
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: libhdfs
> Reporter: Mariappan Asokan
> Priority: Minor
> Attachments: HDFS-2461.0.patch
>
>
> This is to enhance the C API in libhdfs to support HDFS file name globbing.
> The proposal is to keep the new API simple and return a list of matched HDFS
> path names. Callers can use existing hdfsGetPathInfo() to get additional
> information on each of the matched path. Following code snippet shows the
> proposed API enhancements:
> {code:title=hdfs.h}
> /**
> * hdfsGlob - Get all the HDFS file names that match a glob pattern. The
> * returned result will be sorted by the file names. The last element in the
> * array is NULL. The function hdfsFreeGlob() should be called to free this
> * array and its contents.
> * @param fs The configured filesystem handle.
> * @param globPattern The glob pattern to match file names against. Note that
> * this is not a POSIX regular expression but rather a POSIX glob pattern.
> * @return Returns a dynamically-allocated array of strings; if there is no
> * match, an array with one entry that has a NULL value will be returned. If
> * there is an error, NULL will be returned.
> */
> char ** hdfsGlob(hdfsFS fs, const char *globPattern);
> /**
> * hdfsFreeGlob - Free up the array returned by hdfsGlob().
> * @param globResult The array of dynamically-allocated strings returned by
> * hdfsGlob().
> */
> void hdfsFreeGlob(char **globResult);
> {code}
> Please comment on the above proposed API. I will start the implementation
> and testing. However, I need a committer to work with.
> Thanks.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira