bigdata - Alter column data type in Hive -
we need alter table column data type string date. while trying getting below error. please help.
hive> describe sales_staging;
ok
cust_id string prod_num string
qty int sale_date stringsale_id string time taken: 0.151 seconds, fetched: 5 row(s)
hive> alter table sales_staging change sale_date sale_date date ;
failed: execution error, return code 1 org.apache.hadoop.hive.ql.exec.ddltask. unable alter table. following columns have types incompatible existing columns in respective positions :sale_date
hive>
you can't give same name column wish change datatype of. use this
alter table sales_staging change sale_date sale_date_new date;
refer apache hive wiki
Comments
Post a Comment