Hive 配置单元-从hdfs中三个csv文件的特定数据创建配置单元表

Hive 配置单元-从hdfs中三个csv文件的特定数据创建配置单元表,hive,hdfs,hiveql,hive-table,Hive,Hdfs,Hiveql,Hive Table,我有三个.csv文件,每个文件位于不同的hdfs目录中。现在,我想用这三个文件中的数据创建一个配置单元内部表。我想要第一个文件中的四列,第二个文件中的三列和第三个文件中的两列。第一个文件与第二个文件共享一个唯一id列,第三个文件与第三个文件共享另一个唯一id列。两个唯一ID都存在于第二个文件中;使用这些ID,我想留下外部连接来创建表 文件1:“/directory\u 1/sub\u directory\u 1/table1\u data\u on\u 01\u 2014.csv” 文件2:“/

我有三个
.csv
文件,每个文件位于不同的hdfs目录中。现在,我想用这三个文件中的数据创建一个配置单元内部表。我想要第一个文件中的四列,第二个文件中的三列和第三个文件中的两列。第一个文件与第二个文件共享一个唯一id列,第三个文件与第三个文件共享另一个唯一id列。两个唯一ID都存在于第二个文件中;使用这些ID,我想留下外部连接来创建表

文件1:“/directory\u 1/sub\u directory\u 1/table1\u data\u on\u 01\u 2014.csv”
文件2:“/directory_2/sub_directory_2/table2_data_on_01_2014.csv”
文件3:“/directory_3/sub_directory_3/table3_data_on_01_2014.csv”

文件1的内容:

unique_id_1,age,department,reason_of_visit,--more columns--,,,
id_11,entry_12,entry_13,entry_14,--more entries--
id_12,entry_22,entry_23,entry_24,--more entries--
id_13,entry_32,entry_33,entry_34,--more entries--
文件2的内容:

unique_id_1,date_of_transaction,transaction_fee,unique_id_2--more columns--,,,
id_11,entry_121,entry_131,id_21,--more entries--
id_12,entry_221,entry_231,id_22,--more entries--
id_13,entry_321,entry_331,id_23,--more entries--
文件3的内容:

unique_id_2,diagnosis,gender --more columns--,,,
id_21,entry_141,entry_151,--more entries--
id_22,entry_241,entry_151,--more entries--
id_23,entry_341,entry_151,--more entries--
我现在想制作一个如下的内部表:

unique_id_1 age department reason_of_visit date_of_transaction unique_id_2 transaction_fee diagnosis gender
id_11 entry_12 entry_13 entry_14 entry_121 entry_131 id_21 entry_141 entry_151
id_12 entry_22 entry_23 entry_24 entry_221 entry_231 id_22 entry_241 entry_251
id_13 entry_32 entry_33 entry_34 entry_321 entry_331 id_23 entry_341 entry_251

如何实现这一点?

@Naveen Kumar这里的解决方案是为您的3个源创建外部表。接下来,为3个源中需要的列创建带有模式的组合内部表。我称之为临时表或临时表。创建这些暂存表后,您应该能够将联接选择作为插入到组合表选择中…

@Naveen Kumar这里的解决方案是为您的3个源创建外部表。接下来,为3个源中需要的列创建带有模式的组合内部表。我称之为临时表或临时表。创建这些暂存表后,您应该能够将联接选择作为插入到组合_表选择中