Hive - 如何在hive表中插入一个struct数组

时间:2018-06-04 12:05:33

标签: hive hiveql

所以我从here学到了如何将值插入数组列:

INSERT INTO table 
SELECT ARRAY("line1", "line2", "line3") as myArray
FROM source1;

here如何将值插入结构列:

INSERT INTO table 
SELECT NAMED_STRUCT('houseno','123','streetname','GoldStreet', 'town','London', 'postcode','W1a9JF') AS address 
FROM source2;

现在我试图以相同的方式插入结构数组中的值。其中包含以下架构:

additionalattribute:array<struct<attribute_value:string,key:string,value:string>

我试图像这样推断:

  INSERT INTO table 
  ARRAY(NAMED_STRUCT('attribute_value','null','key','null','value','null')) as additionalattribute
  FROM source2;

但它不起作用。有谁知道如何处理这个问题?

1 个答案:

答案 0 :(得分:0)

您缺少表名后面的select语句。演示

String
相关问题