使用如下所示在struct内部定义struct的表
CREATE TABLE IF NOT EXISTS test12(
source_row_nbr int,
claim_record STRUCT < claim_sub_record1: STRUCT<claim_nbr:INT,claim_txt:CHAR(10)>,
claim_sub_record2: STRUCT<claim_nbr:INT,claim_addr:CHAR(20)>>
) stored as ORC
TBLPROPERTIES('orc.compress'='SNAPPY','transactional'='false');
如何使用NAMED_STRUCT
关键字插入记录
答案 0 :(得分:0)
insert into table test12
select 1 as source_row_nbr ,
named_struct('claim_sub_record1', named_struct('claim_nbr',123,'claim_txt','claim 123'),
'claim_sub_record2', named_struct('claim_nbr',124,'claim_txt','claim 124')
) as claim_record
from dummy_table limit 1;