ddl—如何在配置单元中创建包含收集的项的表?

k0pti3hp  于 2021-06-28  发布在  Hive
关注(0)|答案(0)|浏览(252)

这可能真的没什么,但我是新的Hive。我不知道在Hive里怎么做?我试图在配置单元中创建一个外部表,其中一列的数据类型为array。我的示例数据如下所示:

QuRYeRnAuXM EvilSquirrelPictures 1135 Pets&Animals 252 1075 4.96 46 86 gFa1YMEJFag nRcovJn9xHg 3TYqkBJ9YRk

现在,问题是我的列被“\t”分隔,我希望最后三列(gfa1ymejfag nrcovjn9xhg 3tyqkbj9yrk)放在一个列中,即相关的\u视频\u id。我试着为我的table设计了ddl,下面是它的外观:

create external table youtube(video_id char(12), uploader string, time_of_est int, 
category string, len int, views int, ratings float, num_of_rat int, comments int,
related_video_ids array<struct<col1:string,col2:string,col3:string>>) row format delimited
fields terminated by '\t' 
collection items terminated by '\t' 
location '/youtube/';

但每次在hive中编写上述查询时,都会得到如下结果:

QuRYeRnAuXM  EvilSquirrelPictures   1135    Pets & Animals  252     1075    4.96000003815   46  86  [{"col1":"gFa1YMEJFag","col2":null,"col3":null}]

请帮我找到我table的正确ddl。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题