You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by mo...@apache.org on 2017/08/31 20:22:48 UTC

reef git commit: [REEF-1827] new Uri(path) in REEF.NET IO Returns Lowercase String

Repository: reef
Updated Branches:
  refs/heads/master 4d1b80e10 -> d8cb35e49


[REEF-1827] new Uri(path) in REEF.NET IO Returns Lowercase String

Fixed Uri lowercase problem in hdfs by passing .AbsolutePath in the dfs command.

JIRA: [REEF-1857](https://issues.apache.org/jira/browse/REEF-1827)

Closes #1331


Project: http://git-wip-us.apache.org/repos/asf/reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/d8cb35e4
Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/d8cb35e4
Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/d8cb35e4

Branch: refs/heads/master
Commit: d8cb35e49b49cf2fc781def2d180b6da26a24420
Parents: 4d1b80e
Author: Shouheng Yi <sh...@microsoft.com>
Authored: Thu Jul 13 13:01:45 2017 -0700
Committer: Sergiy Matusevych <mo...@apache.org>
Committed: Thu Aug 31 13:20:07 2017 -0700

----------------------------------------------------------------------
 .../HadoopFileSystemTest.cs                     |  4 ++--
 .../FileSystem/Hadoop/HadoopFileSystem.cs       | 20 ++++++++++----------
 2 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/reef/blob/d8cb35e4/lang/cs/Org.Apache.REEF.IO.TestClient/HadoopFileSystemTest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO.TestClient/HadoopFileSystemTest.cs b/lang/cs/Org.Apache.REEF.IO.TestClient/HadoopFileSystemTest.cs
index 35f8848..ab50225 100644
--- a/lang/cs/Org.Apache.REEF.IO.TestClient/HadoopFileSystemTest.cs
+++ b/lang/cs/Org.Apache.REEF.IO.TestClient/HadoopFileSystemTest.cs
@@ -50,7 +50,7 @@ namespace Org.Apache.REEF.IO.TestClient
         {
             bool result = false;
 
-            var localFile = MakeLocalBanaryFile();
+            var localFile = MakeLocalBinaryFile();
             Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "localFile {0}: ", localFile));
 
             var localFileDownloaded = localFile + ".2";
@@ -109,7 +109,7 @@ namespace Org.Apache.REEF.IO.TestClient
             return true;
         }
 
-        private string MakeLocalBanaryFile()
+        private string MakeLocalBinaryFile()
         {
             var result = Path.GetTempFileName();
             WriteFileTest(result);

http://git-wip-us.apache.org/repos/asf/reef/blob/d8cb35e4/lang/cs/Org.Apache.REEF.IO/FileSystem/Hadoop/HadoopFileSystem.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO/FileSystem/Hadoop/HadoopFileSystem.cs b/lang/cs/Org.Apache.REEF.IO/FileSystem/Hadoop/HadoopFileSystem.cs
index fa7faae..a38e547 100644
--- a/lang/cs/Org.Apache.REEF.IO/FileSystem/Hadoop/HadoopFileSystem.cs
+++ b/lang/cs/Org.Apache.REEF.IO/FileSystem/Hadoop/HadoopFileSystem.cs
@@ -72,12 +72,12 @@ namespace Org.Apache.REEF.IO.FileSystem.Hadoop
             try
             {
                 uri = new Uri(path);
-                Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "Uri {0} created in CreateUriForPath.", uri));
+                Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "Uri {0} created in CreateUriForPath.", uri.AbsolutePath));
             }
             catch (UriFormatException)
             {
                 uri = new Uri(_uriPrefix + path);
-                Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "Uri {0} created in CreateUriForPath with prefix added.", uri));
+                Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "Uri {0} created in CreateUriForPath with prefix added.", uri.AbsolutePath));
             }
 
             return uri;
@@ -118,7 +118,7 @@ namespace Org.Apache.REEF.IO.FileSystem.Hadoop
         public void Delete(Uri fileUri)
         {
             // Delete the file via the hdfs command line.
-            _commandRunner.Run("dfs -rm " + fileUri);
+            _commandRunner.Run("dfs -rm " + fileUri.AbsolutePath);
         }
 
         public bool Exists(Uri fileUri)
@@ -126,38 +126,38 @@ namespace Org.Apache.REEF.IO.FileSystem.Hadoop
             // This determines the existence of a file based on the 'ls' command. 
             // Ideally, we'd use the 'test' command's return value, but we did not find a way to access that.
             return
-                _commandRunner.Run("dfs -ls " + fileUri).StdErr
+                _commandRunner.Run("dfs -ls " + fileUri.AbsolutePath).StdErr
                     .All(line => !NoSuchFileOrDirectoryRegEx.IsMatch(line));
         }
 
         public void Copy(Uri sourceUri, Uri destinationUri)
         {
-            _commandRunner.Run("dfs -cp " + sourceUri + " " + destinationUri);
+            _commandRunner.Run("dfs -cp " + sourceUri.AbsolutePath + " " + destinationUri.AbsolutePath);
         }
 
         public void CopyToLocal(Uri remoteFileUri, string localName)
         {
-            _commandRunner.Run("dfs -get " + remoteFileUri + " " + localName);
+            _commandRunner.Run("dfs -get " + remoteFileUri.AbsolutePath + " " + localName);
         }
 
         public void CopyFromLocal(string localFileName, Uri remoteFileUri)
         {
-            _commandRunner.Run("dfs -put " + localFileName + " " + remoteFileUri);
+            _commandRunner.Run("dfs -put " + localFileName + " " + remoteFileUri.AbsolutePath);
         }
 
         public void CreateDirectory(Uri directoryUri)
         {
-            _commandRunner.Run("dfs -mkdir " + directoryUri);
+            _commandRunner.Run("dfs -mkdir " + directoryUri.AbsolutePath);
         }
 
         public void DeleteDirectory(Uri directoryUri)
         {
-            _commandRunner.Run("dfs -rmdir " + directoryUri);
+            _commandRunner.Run("dfs -rmdir " + directoryUri.AbsolutePath);
         }
 
         public IEnumerable<Uri> GetChildren(Uri directoryUri)
         {
-            return _commandRunner.Run("dfs -ls " + directoryUri)
+            return _commandRunner.Run("dfs -ls " + directoryUri.AbsolutePath)
                 .StdOut.Where(line => !LsFirstLineRegex.IsMatch(line))
                 .Select(line => line.Split())
                 .Select(x => new Uri(x[x.Length - 1]));