hive中将单行拆分成多行总结
hive中将单行拆分成多行 初始值: id name mobiles 1 jim 139,177,158 想得到的结果: id name mobiles 1 jim 139 1 jim 177 1 jim 158 创建测试数据 CREATE TABLE fwj.customer ( id STRING, name STRING, mobiles STRING); INSERT INTO fwj.customer SELECT '1','jim','139,177,158' FROM system.dual; 1.最笨的办法: 逻辑简单,写法粗暴,可拓展性为0。 SELECT a.id,a.name,substr(a.mobiles,1,3) mobiles FROM fwj.customer a UNION ALL SELECT a.id,a.name,substr(a.mobiles,5,3) mobiles FROM fwj.customer a UNION ALL SELECT a.id,a.name,substr(a.mobiles,9,3) mobiles FROM fwj....





