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



如何用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.

最新更新