【发布时间】:2018-04-28 07:53:47
【问题描述】:
我在 hive 中的表具有如下架构:
DESCRIBE struct_demo;
+-------------------+-------------------------------+
| name | type |
+-------------------+-------------------------------+
| lr_id | string |
| segment_info | ARRAY<struct< |
| | idlpSegmentName:string, |
| | idlpSegmentValue:string > |
| | > |
| | |
+-------------------+-------------------------------+
我在 Redshift(或任何 Sql 数据库)中创建表 它为 hive 中的上述数据类型创建了具有类似格式的行, 但作为字符串。
在将数据从 redshift 插入 hive 时如何进行投射? 更具体地说,如何从字符串转换为结构数组?
我的 SQL 表:
lr_id | segment_info
---------|------------------------------------------------------------
1 | [{"idlpsegmentname":"axciom","idlpsegmentvalue":"200"},{"idlpsegmentname":"people","idlpsegmentvalue":"z"}]
到目前为止,找不到任何符合要求的 udf。
【问题讨论】:
标签: hadoop hive amazon-redshift