[ 
https://issues.apache.org/jira/browse/BEAM-4011?focusedWorklogId=90515&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-90515
 ]

ASF GitHub Bot logged work on BEAM-4011:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 12/Apr/18 18:15
            Start Date: 12/Apr/18 18:15
    Worklog Time Spent: 10m 
      Work Description: chamikaramj commented on a change in pull request 
#5024: [BEAM-4011] Unify Python IO glob implementation.
URL: https://github.com/apache/beam/pull/5024#discussion_r181162315
 
 

 ##########
 File path: sdks/python/apache_beam/io/filesystem.py
 ##########
 @@ -510,7 +551,48 @@ def match(self, patterns, limits=None):
     Raises:
       ``BeamIOError`` if any of the pattern match operations fail
     """
-    raise NotImplementedError
+    if limits is None:
+      limits = [None] * len(patterns)
+    else:
+      err_msg = "Patterns and limits should be equal in length"
+      assert len(patterns) == len(limits), err_msg
+
+    def _match(pattern, limit):
+      """Find all matching paths to the pattern provided."""
+      if pattern.endswith('/'):
+        pattern += '*'
+      prefix_or_dir = re.match('^[^[*?]*', pattern).group(0)
+
+      file_metadatas = []
+      if prefix_or_dir == pattern:
+        # Short-circuit calling self.list() if there's no glob pattern to 
match.
+        if self.exists(pattern):
+          file_metadatas = [FileMetadata(pattern, self.size(pattern))]
+      else:
+        if self.has_dirs():
 
 Review comment:
   Wasn't sure from code, but do we try to list "\<path\>/\*" for 
"\<path\>/\<prefix\>*" ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 90515)
    Time Spent: 1h 10m  (was: 1h)

> Python SDK: add glob support for HDFS
> -------------------------------------
>
>                 Key: BEAM-4011
>                 URL: https://issues.apache.org/jira/browse/BEAM-4011
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-py-core
>            Reporter: Udi Meiri
>            Assignee: Udi Meiri
>            Priority: Major
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to