实验项目名称多表关联实验成绩实验者专业班级组别同组者实验日期2025.1.9第一部分:实验分析与设计(可加页)一、 实验内容描述(问题域描述)输入两个文件:一个代表工厂表,包含工厂名列和地址编号列;另一个代表地址表,包含地址名列和地址编号列。从输入数据中找出工厂名和地址名的对应关系,输出“工厂名——地址名”表,按工厂名排序输出;数据文件自己设计样例。二、 实验基本原理与设计(包括实验方案设计,实验手段的确定,试验步骤等,用硬件逻辑或者算法描述)具体的算法实现如下:public class MTjoin { public static int time = 0; /* 在 map 中先区分输入行属于左表还是右表,然后对两列值进行分割, * 保存连接列在 key 值,剩余列和左右表标志在 value 中,最后输出 */ public static class Map extends Mapper〈Object, Text, Text, Text〉 { // 实现 map 函数 public void map(Object key, Text value, Context context)throws IOException, InterruptedException { String line = value.toString();// 每行文件 String relationtype = new String();// 左右表标识 // 输入文件首行,不处理 if(line 。 contains("factoryname")==true||line.contains("addressed”)== true){ return; } // 输入的一行预处理文本 StringTokenizer itr = new StringTokenizer(line); String mapkey = new String(); String mapvalue = new String(); int i = 0; while (itr.hasMoreTokens()) { // 先读取一个单词 String token = itr.nextToken(); // 推断该地址 ID 就把存到”values[0]” if ( token.charAt ( 0 ) 〉 =’0'& & token.charAt(0)〈='9’){ mapkey = token; if (i > 0) { relationtype = "1"; } else { relationtype = "2"; } continue; } // 存工厂名 mapvalue += token + ” ”; i++; } // 输出左右表 context 。 write(new Text(mapkey ) , new Text(relationtype + ”+”+ mapvalue)); } } /*reduce 解析 map 输出,将 value 中数据根据左右表分别保存, * 然后求出笛卡尔积,并输出。 */public static class Reduce extends Reducer { // 实现 reduce 函数 public...