我有一个蜂房表emp_test如下:如何在Hive中爆炸未知数组长度的嵌套数组结构?
'名称' 作为字符串
'测试' 作为阵列<结构<代码:串,测试:阵列<结构< testtype:串,errorline:串>>> >
和具有列值: “名称” 为 “JOHN” 和 “测试” 作为
[{ “代码”: “cod1234”, “测试”:[{ “testtype”: “Java” 的“errorline”: “100”},{ “testtype”: “C++”, “errorline”: “10000”}]},
{“鳕鱼E “:” cod6790" , “测试”:[{ “testtype”: “蜂巢”, “errorline”: “10”},{ “testtype”: “猪”, “errorline”: “978”},{” testtype “:” 火花”, “errorline”: “35”}]} ]
如何选择这些值,并存储在另一个表emp_test_detail(名称,代码testtype,errorline)作为
JOHN cod1234的java 100
JOHN cod1234 C++ 10000
JOHN cod6790蜂房10
JOHN cod6790猪978
JOHN cod6790火花35
我已经尝试下面的查询,但得到的错误:
插入件插入emp_test_detail选择
emp_tasting.code,
emp_tasting.emp_tests.testtype,
emp_tasting.emp_tests.errorline从emp_test
侧视图爆炸(测试) mytest as emp_tasting
lateral view explode(testing [0] .tests)mytest as emp_tasting;
,在这里我不知道测试阵列的确切长度。那么如何引用数组字段?
请帮我在这?