Search code examples
sqlhadoophiveimpala

add a new column in Impala to update complex type


I have a table with complex types in it's schema for instance:

address   ARRAY<STRUCT<street:STRING, state:STRING, names:ARRAY<STRING>, zip:INT>>

I wonder how I can change it to

address   ARRAY<STRUCT<street:STRING, city:STRING, state:STRING, names:ARRAY<STRING>, zip:INT>>

with an alter query?


Solution

  • We can use ALTER and CHANGE:

    ALTER table name_of_table CHANGE address address ARRAY<STRUCT<street:STRING, city:STRING, state:STRING, names:ARRAY<STRING>, zip:INT>>