Hive - alter struct column with nested struct field

Viewed 20

I have table with following structure:

CREATE TABLE test.news
  (                   
  `event` string,                              
  `description` string,      
  `info` struct<data:struct<url:string,adress:string,errors:string>, ip:string>,                 
  `id` string)        
PARTITIONED BY (           
  `date` string)

And I need to expand my 'info' columns with following elements:

enabled:string,no:string

To get following table structure:

CREATE TABLE test.news
  (                   
  `event` string,                              
  `description` string,      
  `info` struct<enabled:string,no:string,data:struct<url:string,adress:string,errors:string>, ip:string>,                 
  `id` string)        
PARTITIONED BY (           
  `date` string)

But when I alter column, it will result with errors when using SELECT on my table. This is ALTER expression I used:

ALTER TABLE test.news
CHANGE COLUMN info info struct<enabled:string,no:string,data:struct<url:string,adress:string,errors:string>, ip:string>

Is it even possible to do this with nested struct inside another struct? This worked fine work me when I just need to expand struct with another elements (without another struct inside struct)...

0 Answers
Related