当我们写好一个MapReduce函数时,由于测试,经常需要手动将之前的输出路径删除掉,不然的话,就会报以下的错误:

解决MapReduce输出路径已存在的问题

这个时候,我们只需要在我们的Driver端代码里面添加以下几行代码即可:

 FileSystem fileSystem = FileSystem.get(configuration);
        Path outputPath = new Path("output/d=20180717");
        if(fileSystem.exists(outputPath)){
            fileSystem.delete(outputPath,true);
        }

 

相关文章:

  • 2021-11-03
  • 2021-07-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
  • 2021-11-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-06
  • 2022-12-23
相关资源
相似解决方案