From a2956637298be53e19a5856e139b591bd4ffc0c8 Mon Sep 17 00:00:00 2001 From: pengzhuang Date: Mon, 21 Jun 2021 11:29:23 +0800 Subject: [PATCH] =?UTF-8?q?hdfswriter=E6=8F=92=E4=BB=B6buildTmpFilePath?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E9=80=82=E9=85=8Dwindow=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E6=8B=BC=E6=8E=A5=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=B0=83=E8=AF=95=E5=86=99=E5=85=A5=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E8=A2=AB=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datax/plugin/writer/hdfswriter/HdfsWriter.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hdfswriter/src/main/java/com/alibaba/datax/plugin/writer/hdfswriter/HdfsWriter.java b/hdfswriter/src/main/java/com/alibaba/datax/plugin/writer/hdfswriter/HdfsWriter.java index 853613a2..513b67ff 100644 --- a/hdfswriter/src/main/java/com/alibaba/datax/plugin/writer/hdfswriter/HdfsWriter.java +++ b/hdfswriter/src/main/java/com/alibaba/datax/plugin/writer/hdfswriter/HdfsWriter.java @@ -309,7 +309,9 @@ public class HdfsWriter extends Writer { }else if("/".equals(userPath)){ tmpFilePath = String.format("%s__%s%s", userPath, tmpSuffix, IOUtils.DIR_SEPARATOR); }else{ - tmpFilePath = String.format("%s__%s%s", userPath.substring(0,userPath.length()-1), tmpSuffix, IOUtils.DIR_SEPARATOR); +// tmpFilePath = String.format("%s__%s%s", userPath.substring(0,userPath.length()-1), tmpSuffix, IOUtils.DIR_SEPARATOR); + // 适配window系统目录拼接 + tmpFilePath = String.format("%s__%s%s", userPath, tmpSuffix, IOUtils.DIR_SEPARATOR_UNIX); } while(hdfsHelper.isPathexists(tmpFilePath)){ tmpSuffix = UUID.randomUUID().toString().replace('-', '_'); @@ -318,7 +320,9 @@ public class HdfsWriter extends Writer { }else if("/".equals(userPath)){ tmpFilePath = String.format("%s__%s%s", userPath, tmpSuffix, IOUtils.DIR_SEPARATOR); }else{ - tmpFilePath = String.format("%s__%s%s", userPath.substring(0,userPath.length()-1), tmpSuffix, IOUtils.DIR_SEPARATOR); +// tmpFilePath = String.format("%s__%s%s", userPath.substring(0,userPath.length()-1), tmpSuffix, IOUtils.DIR_SEPARATOR); + // 适配window系统目录拼接 + tmpFilePath = String.format("%s__%s%s", userPath, tmpSuffix, IOUtils.DIR_SEPARATOR_UNIX); } } return tmpFilePath;