Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hadoop 蜂巢阵列爆炸问题_Hadoop_Hive - Fatal编程技术网

Hadoop 蜂巢阵列爆炸问题

Hadoop 蜂巢阵列爆炸问题,hadoop,hive,Hadoop,Hive,嗨,我有一个使用蜂巢阵列爆炸的场景 我有一个包含多个数组(4个数组)的配置单元表 当所有数组列reportee_name、reportee_age、reportee_accountry、reportee_salary有3个元素时,reportee_address只有2个元素 所以,当我做posexplode横向视图时,我将只得到2个元素 select supervisorid,reportee_name_val,reportee_age_val,reportee_address_val,repo

嗨,我有一个使用蜂巢阵列爆炸的场景

我有一个包含多个数组(4个数组)的配置单元表

当所有数组列reportee_name、reportee_age、reportee_accountry、reportee_salary有3个元素时,reportee_address只有2个元素

所以,当我做posexplode横向视图时,我将只得到2个元素

select supervisorid,reportee_name_val,reportee_age_val,reportee_address_val,reportee_occupation_val,reportee_salary_val from manager lateral view posexplode(reportee_name)reportee_name  as reportee_name_pos,reportee_name_val lateral view posexplode(reportee_age)reportee_age as reportee_age_pos,reportee_age_val lateral view posexplode (reportee_address)reportee_address as reportee_address_pos,reportee_address_val lateral view posexplode (reportee_occupation)reportee_occupation as reportee_occupation_pos,reportee_occupation_val lateral view posexplode(reportee_salary)reportee_salary as reportee_salary_pos,reportee_salary_val where reportee_name_pos<=>reportee_age_pos and reportee_age_pos<=>reportee_address_pos and reportee_address_pos<=>reportee_occupation_pos and reportee_occupation_pos<=>reportee_salary_pos; 
OK
101 richie  36  abc SE  5000
101 tom 28  xyz JSE 3000
Time taken: 0.175 seconds, Fetched: 2 row(s)
从以下查询获得的输出

select supervisorid,reportee_name_val,reportee_age_val,reportee_address_val,reportee_occupation_val,reportee_salary_val from manager lateral view posexplode(reportee_name)reportee_name  as reportee_name_pos,reportee_name_val lateral view posexplode(reportee_age)reportee_age as reportee_age_pos,reportee_age_val lateral view posexplode (reportee_address)reportee_address as reportee_address_pos,reportee_address_val lateral view posexplode (reportee_occupation)reportee_occupation as reportee_occupation_pos,reportee_occupation_val lateral view posexplode(reportee_salary)reportee_salary as reportee_salary_pos,reportee_salary_val where reportee_name_pos<=>reportee_age_pos and reportee_age_pos<=>reportee_address_pos and reportee_address_pos<=>reportee_occupation_pos and reportee_occupation_pos<=>reportee_salary_pos;


101,richie,36,abc,SE,5000
101,tom,28,xyz,JSE,3000
从经理侧视图位置中选择主管ID、报告人姓名、报告人年龄、报告人地址、报告人职业、报告人工资等(报告人的地址)报告人的地址作为报告人的地址,报告人的地址作为报告人的横向视图posexplode(报告人的职业)报告人的职业作为报告人的职业pos,报告人的职业作为报告人的横向视图posexplode(报告人的工资)被报告人工资作为被报告人工资,被报告人工资,其中被报告人姓名、年龄、地址、职业和被报告人工资;
里奇101号,36号,美国广播公司,东南部,5000
101,汤姆,28,xyz,JSE,3000
我期望每个数组的所有元素,如果任何数组的元素数较少,则在横向视图中应为空


如果您丢失的n元素不是最后一个元素,根据定义,则您的数据已损坏。使用NULL作为缺少元素的占位符比使用结构数组而不是多个数组更好,更好的方法是规范化数据并创建附加表而不是数组分析在配置单元脚本中动态地将NULL添加到元素数较少的数组中是可能的。这是一个非常糟糕的数据建模。我强烈建议使用另一个选项。
select supervisorid,reportee_name_val,reportee_age_val,reportee_address_val,reportee_occupation_val,reportee_salary_val from manager lateral view posexplode(reportee_name)reportee_name  as reportee_name_pos,reportee_name_val lateral view posexplode(reportee_age)reportee_age as reportee_age_pos,reportee_age_val lateral view posexplode (reportee_address)reportee_address as reportee_address_pos,reportee_address_val lateral view posexplode (reportee_occupation)reportee_occupation as reportee_occupation_pos,reportee_occupation_val lateral view posexplode(reportee_salary)reportee_salary as reportee_salary_pos,reportee_salary_val where reportee_name_pos<=>reportee_age_pos and reportee_age_pos<=>reportee_address_pos and reportee_address_pos<=>reportee_occupation_pos and reportee_occupation_pos<=>reportee_salary_pos; 
OK
101 richie  36  abc SE  5000
101 tom 28  xyz JSE 3000
Time taken: 0.175 seconds, Fetched: 2 row(s)
101,richie,36,abc,SE,5000
101,tom,28,xyz,JSE,3000
101,jack,29,NULL,SE
select supervisorid,reportee_name_val,reportee_age_val,reportee_address_val,reportee_occupation_val,reportee_salary_val from manager lateral view posexplode(reportee_name)reportee_name  as reportee_name_pos,reportee_name_val lateral view posexplode(reportee_age)reportee_age as reportee_age_pos,reportee_age_val lateral view posexplode (reportee_address)reportee_address as reportee_address_pos,reportee_address_val lateral view posexplode (reportee_occupation)reportee_occupation as reportee_occupation_pos,reportee_occupation_val lateral view posexplode(reportee_salary)reportee_salary as reportee_salary_pos,reportee_salary_val where reportee_name_pos<=>reportee_age_pos and reportee_age_pos<=>reportee_address_pos and reportee_address_pos<=>reportee_occupation_pos and reportee_occupation_pos<=>reportee_salary_pos;


101,richie,36,abc,SE,5000
101,tom,28,xyz,JSE,3000