You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by xk...@apache.org on 2018/09/24 18:45:35 UTC
[11/50] [abbrv] hadoop git commit: HADOOP-15753. ABFS: support path
"abfs://mycluster/file/path" Contributed by Da Zhou.
HADOOP-15753. ABFS: support path "abfs://mycluster/file/path"
Contributed by Da Zhou.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/26211019
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/26211019
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/26211019
Branch: refs/heads/HDFS-12943
Commit: 26211019c80e6180297dd94abcefe718b70e8cd9
Parents: e5593cb
Author: Thomas Marquardt <tm...@microsoft.com>
Authored: Fri Sep 14 16:50:26 2018 +0000
Committer: Thomas Marquardt <tm...@microsoft.com>
Committed: Mon Sep 17 19:54:01 2018 +0000
----------------------------------------------------------------------
.../hadoop/fs/azurebfs/AzureBlobFileSystem.java | 23 +++++++++++++++++++
.../ITestAzureBlobFileSystemFileStatus.java | 24 ++++++++++++++++++++
2 files changed, 47 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/26211019/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystem.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystem.java b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystem.java
index 7cbf4d7..2e8de78 100644
--- a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystem.java
+++ b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystem.java
@@ -366,6 +366,29 @@ public class AzureBlobFileSystem extends FileSystem {
}
}
+ /**
+ * Qualify a path to one which uses this FileSystem and, if relative,
+ * made absolute.
+ * @param path to qualify.
+ * @return this path if it contains a scheme and authority and is absolute, or
+ * a new path that includes a path and authority and is fully qualified
+ * @see Path#makeQualified(URI, Path)
+ * @throws IllegalArgumentException if the path has a schema/URI different
+ * from this FileSystem.
+ */
+ @Override
+ public Path makeQualified(Path path) {
+ // To support format: abfs://{dfs.nameservices}/file/path,
+ // path need to be first converted to URI, then get the raw path string,
+ // during which {dfs.nameservices} will be omitted.
+ if (path != null ) {
+ String uriPath = path.toUri().getPath();
+ path = uriPath.isEmpty() ? path : new Path(uriPath);
+ }
+ return super.makeQualified(path);
+ }
+
+
@Override
public Path getWorkingDirectory() {
return this.workingDir;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/26211019/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemFileStatus.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemFileStatus.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemFileStatus.java
index b08b920..02f938f 100644
--- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemFileStatus.java
+++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemFileStatus.java
@@ -98,4 +98,28 @@ public class ITestAzureBlobFileSystemFileStatus extends
validateStatus(fs, TEST_FOLDER, true);
}
+ @Test
+ public void testAbfsPathWithHost() throws IOException {
+ AzureBlobFileSystem fs = this.getFileSystem();
+ Path pathWithHost1 = new Path("abfs://mycluster/abfs/file1.txt");
+ Path pathwithouthost1 = new Path("/abfs/file1.txt");
+
+ Path pathWithHost2 = new Path("abfs://mycluster/abfs/file2.txt");
+ Path pathwithouthost2 = new Path("/abfs/file2.txt");
+
+ // verify compatibility of this path format
+ fs.create(pathWithHost1);
+ assertTrue(fs.exists(pathwithouthost1));
+
+ fs.create(pathwithouthost2);
+ assertTrue(fs.exists(pathWithHost2));
+
+ // verify get
+ FileStatus fileStatus1 = fs.getFileStatus(pathWithHost1);
+ assertEquals(pathwithouthost1.getName(), fileStatus1.getPath().getName());
+
+ FileStatus fileStatus2 = fs.getFileStatus(pathwithouthost2);
+ assertEquals(pathWithHost2.getName(), fileStatus2.getPath().getName());
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org