如何使用Mapreduce在HDFS中强制存储(覆盖)

如何使用Mapreduce在HDFS中强制存储(覆盖),mapreduce,Mapreduce,如何使用Mapreduce程序覆盖HDFS中的现有输出 在Pig中有一个语句称为 rmf /user/cloudera/outputfiles/citycount STORE rel into '/user/cloudera/outputfiles/citycount'; 类似地,在mapreduce程序中是否有任何方法可以实现相同的功能?您可以在驱动程序模块中这样做 conf = new Configuration(); FileSystem fs = FileSystem.get(c

如何使用Mapreduce程序覆盖HDFS中的现有输出

在Pig中有一个语句称为

rmf /user/cloudera/outputfiles/citycount
STORE rel into '/user/cloudera/outputfiles/citycount';

类似地,在mapreduce程序中是否有任何方法可以实现相同的功能?您可以在驱动程序模块中这样做

 conf = new Configuration();

 FileSystem fs = FileSystem.get(conf);

 String pathin = args[0];
 String pathout = args[1];

 fs.delete(new Path(pathout), true);


 // it will delete the output folder if the folder already exists.