我的CSV数据看起来像
David,"""SMARTPHONE,6""|""COMPUTER,3""|""LAPTOP,1"""
我尝试将其加载到配置单元表中
create table user_device(name string, devices array<struct<devicename: string, number : int>>)
FIELDS TERMINATED BY ','
collection items terminated by '|'
STORED AS TEXTFILE
LOCATION 'maprfs:///user/david/';
我希望看到
[{"devicename":"SMARTPHONE","number":6},{"devicename":"COMPUTER","number":3},{"devicename":"LAPTOP","number":1}]
但是当我尝试查询表时,我看到struct的数组是
[{"devicename":"\"\"\"SMARTPHONE","number":null}]
数组和结构的其余部分都消失了。
有人知道我能做到这一点吗?
谢谢 大卫