0

Trying to change the cloumn type in hive, running a DDL, but it's throwing an error

Running the following DDL:

ALTER TABLE INV.HTL_RATE_PLAN
CHANGE RATE_PLAN_RSTRCT_STRT_DT RATE_PLAN_RSTRCT_STRT_DT DATE 
COMMENT 'Advance booking alternate days restriction rule applied to a rate category. This rule dictates the minimum number of days before arrival the guest must book for the rate category to be available.'
AFTER PRICE_GRID_CD;

Error:

Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Reordering columns is not supported for table INV_TRF.HTL_RATE_PLAN. SerDe may be incompatible.

Help? What am I doing Wrong. Please Suggest.

dtolnay
  • 9,621
  • 5
  • 41
  • 62
ruthvik
  • 11
  • 1

1 Answers1

1

To change column type, you need just for this :

ALTER TABLE INV.HTL_RATE_PLAN
CHANGE RATE_PLAN_RSTRCT_STRT_DT RATE_PLAN_RSTRCT_STRT_DT DATE 
COMMENT 'Advance booking alternate days restriction rule applied to a rate category. This rule dictates the minimum number of days before arrival the guest must book for the rate category to be available.';

Th removed part AFTER PRICE_GRID_CD change the column position to be after the specified column, but your storage type which is handled by the serde, does not support this operation.

54l3d
  • 3,913
  • 4
  • 32
  • 58