0

I have a hive table saved in ORC files, this is the definition in the "create" command:

ROW FORMAT SERDE
  'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
STORED AS INPUTFORMAT
  'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
OUTPUTFORMAT
  'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'

I want to drop a column from the end, so I tried the "Alter Table - Replace Columns" command, where I didn't write the column name - but got this error: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Replacing columns cannot drop columns for table default.table. SerDe may be incompatible

Is there a way to replace columns in a ORC table in Hive? Google failed me on this subject....

Thanks!

E_net4
  • 27,810
  • 13
  • 101
  • 139
Bramat
  • 979
  • 4
  • 24
  • 40

1 Answers1

0

As per the hive tutorial,REPLACE COLUMNS command can be done only for tables with a native SerDe (DynamicSerDe, MetadataTypedColumnsetSerDe, LazySimpleSerDe and ColumnarSerDe).

So for your case, create a new table with required column. insert into new table from old table . Rename old table to someother table. Rename new table to old table.

Thanks.