资源简介
Hadoop课程实验和报告——Apriori算法并行实现
代码片段和文件信息
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import Job1_Generate1Item.Generate1Item;
import Job2_GeneratekItem.GeneratekItem;
public class Apriori {
public static void main(String[] args) throws ClassNotFoundException
IOException InterruptedException URISyntaxException {
// TODO Auto-generated method stub
String[] as = new String[]{
“hdfs://192.168.80.139:9000/output“
“hdfs://192.168.80.139:9000/transactions“
“2“
“hdfs://192.168.80.139:9000/output“
};
//steg 1 to get the 1 item set
Generate1Item.main(as);
//setg 2 to get k item set
int i = 0;
while( isContinue(as[0]+“/part-r-00000“) )
{
i++;
as[3] = as[0];
as[0] += i;
GeneratekItem.main(as);
}
}
private static boolean isContinue(String string) throws IOException URISyntaxException {
// TODO Auto-generated method stub
//check the output file whether is null
FileSystem hdfs = FileSystem.get(new URI(string) new Configuration());
Path path = new Path(new URI(string).getPath());
if( hdfs.exists(path) )
{
FileStatus stat = hdfs.getFileStatus(path);
return stat.getLen() > 0;
}
return false;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
..A..H. 18081 2015-05-04 16:46 Project-Apriori\.classpath
..A..H. 426 2015-05-04 16:46 Project-Apriori\.project
文件 373596 2015-06-30 11:11 Project-Apriori\Apriori算法并行实现.docx
文件 2127 2015-05-05 14:53 Project-Apriori\bin\Apriori.class
文件 1905 2015-05-05 14:09 Project-Apriori\bin\Job1_Generate1Item\Generate1Item.class
文件 2508 2015-05-05 11:39 Project-Apriori\bin\Job1_Generate1Item\Generate1ItemMapper.class
文件 3000 2015-05-05 14:02 Project-Apriori\bin\Job1_Generate1Item\Generate1ItemReducer.class
文件 2291 2015-05-05 14:14 Project-Apriori\bin\Job2_GeneratekItem\GeneratekItem.class
文件 8570 2015-05-05 11:39 Project-Apriori\bin\Job2_GeneratekItem\GeneratekItemMapper.class
文件 3000 2015-05-05 13:58 Project-Apriori\bin\Job2_GeneratekItem\GeneratekItemReducer.class
文件 1376 2015-05-05 14:52 Project-Apriori\src\Apriori.java
文件 1236 2015-05-05 14:09 Project-Apriori\src\Job1_Generate1Item\Generate1Item.java
文件 789 2015-05-04 19:25 Project-Apriori\src\Job1_Generate1Item\Generate1ItemMapper.java
文件 1031 2015-05-05 14:02 Project-Apriori\src\Job1_Generate1Item\Generate1ItemReducer.java
文件 1460 2015-05-05 14:14 Project-Apriori\src\Job2_GeneratekItem\GeneratekItem.java
文件 5831 2015-05-05 11:34 Project-Apriori\src\Job2_GeneratekItem\GeneratekItemMapper.java
文件 965 2015-05-05 13:58 Project-Apriori\src\Job2_GeneratekItem\GeneratekItemReducer.java
目录 0 2015-05-05 16:23 Project-Apriori\bin\Job1_Generate1Item
目录 0 2015-05-05 16:23 Project-Apriori\bin\Job2_GeneratekItem
目录 0 2015-05-05 16:23 Project-Apriori\src\Job1_Generate1Item
目录 0 2015-05-05 16:23 Project-Apriori\src\Job2_GeneratekItem
目录 0 2015-05-05 16:23 Project-Apriori\bin
目录 0 2015-05-05 16:23 Project-Apriori\src
目录 0 2015-06-30 11:12 Project-Apriori
----------- --------- ---------- ----- ----
428192 24
评论
共有 条评论