Hi kaducangica, This exception is telling that your data doesn't match to the definition.
So I think you may redefine your Table Schema. A STRUCT is similar conceptually to a table row: it contains a fixed number of named fields, each with a predefined type. The names and number of fields within the STRUCT are fixed. Each field can be a different type. A field within a STRUCT can also be another STRUCT, or an ARRAY or a MAP, allowing you to create nested data structures with a maximum nesting depth of 100. Some related issues you can find helpful: https://community.hortonworks.com/questions/149307/can-i-add-a-subcolumn-to-a-hive-struct-column-usin.html <https://community.hortonworks.com/questions/149307/can-i-add-a-subcolumn-to-a-hive-struct-column-usin.html> > On May 6, 2018, at 6:07 AM, kaducangica <[email protected]> wrote: > > Hi all, > > i have the follwing Hive table on Amazon EMR: > > CREATE TABLE equipment_users ( > user_id bigint, > equipment array<struct<identifier:int,hex:string,battery_level:int>> > ); > > I want to add a new field in equipment column doing this command: > > ALTER TABLE equipment_users CHANGE COLUMN equipment equipment > array<struct<identifier:int,hex:string,battery_level:int,date_installed:timestamp>>; > > But it is giving me the error: > > Error while processing statement: FAILED: Execution Error, return code 1 from > org.apache.hadoop.hive.ql.exec.DDLTask. Unable to alter table. The following > columns have types incompatible with the existing columns in their respective > positions : > equipment > > > Someone can help me do this? Or perhaps sugest another solution to do this. > > Thanks in advance. > > Best regards, > Carlos.
