Browse Source

[hadoop] Allow Hdfs.urlsplit to deal with viewfs (federation)

bc Wong 13 years ago
parent
commit
7680b273a8
1 changed files with 4 additions and 3 deletions
  1. 4 3
      desktop/libs/hadoop/src/hadoop/fs/hadoopfs.py

+ 4 - 3
desktop/libs/hadoop/src/hadoop/fs/hadoopfs.py

@@ -202,17 +202,18 @@ class Hdfs(object):
     if i == -1:
       # Not found. Treat the entire argument as an HDFS path
       return ('hdfs', '', normpath(url), '', '')
-    if url[:i] != 'hdfs':
+    schema = url[:i]
+    if schema not in ('hdfs', 'viewfs'):
       # Default to standard for non-hdfs
       return urlparse.urlsplit(url)
     url = url[i+3:]
     i = url.find('/')
     if i == -1:
       # Everything is netloc. Assume path is root.
-      return ('hdfs', url, '/', '', '')
+      return (schema, url, '/', '', '')
     netloc = url[:i]
     path = url[i:]
-    return ('hdfs', netloc, normpath(path), '', '')
+    return (schema, netloc, normpath(path), '', '')
 
 class HadoopFileSystem(Hdfs):
   """