diff --git a/src/java/org/apache/sqoop/io/SplittingOutputStream.java b/src/java/org/apache/sqoop/io/SplittingOutputStream.java index 60d554f1..5f98192e 100644 --- a/src/java/org/apache/sqoop/io/SplittingOutputStream.java +++ b/src/java/org/apache/sqoop/io/SplittingOutputStream.java @@ -79,8 +79,6 @@ public SplittingOutputStream(final Configuration conf, final Path destDir, /** Initialize the OutputStream to the next file to write to. */ private void openNextFile() throws IOException { - FileSystem fs = FileSystem.get(conf); - StringBuffer sb = new StringBuffer(); Formatter fmt = new Formatter(sb); fmt.format("%05d", this.fileNum++); @@ -89,6 +87,7 @@ private void openNextFile() throws IOException { filename = filename + codec.getDefaultExtension(); } Path destFile = new Path(destDir, filename); + FileSystem fs = destFile.getFileSystem(conf); LOG.debug("Opening next output file: " + destFile); if (fs.exists(destFile)) { Path canonicalDest = destFile.makeQualified(fs); diff --git a/src/java/org/apache/sqoop/util/DirectImportUtils.java b/src/java/org/apache/sqoop/util/DirectImportUtils.java index 8ea9662c..e1bf22f4 100644 --- a/src/java/org/apache/sqoop/util/DirectImportUtils.java +++ b/src/java/org/apache/sqoop/util/DirectImportUtils.java @@ -77,10 +77,10 @@ public static void setFilePermissions(File file, String modstr) public static SplittableBufferedWriter createHdfsSink(Configuration conf, SqoopOptions options, ImportJobContext context) throws IOException { - FileSystem fs = FileSystem.get(conf); Path destDir = context.getDestination(); + FileSystem fs = destDir.getFileSystem(conf); - LOG.debug("Writing to filesystem: " + conf.get("fs.default.name")); + LOG.debug("Writing to filesystem: " + fs.getUri()); LOG.debug("Creating destination directory " + destDir); fs.mkdirs(destDir);