我正在尝试将记录插入配置单元中struct内部的struct中

d4so4syb  于 2021-06-24  发布在  Hive
关注(0)|答案(1)|浏览(349)

用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 关键字

svujldwt

svujldwt1#

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;

相关问题