Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Change input and output format of existing hive table

avatar
Super Collaborator

Hi,

 

How do we change the InputFormat and OutputFormat of an existing Hive table?

 

I tried below, but got an error:

alter table <table name> SET InputFormat "org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat";

 

Error:

Cannot recognize input near 'SET' 'InputFormat' 'org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat'

 

Kindly suggest

1 ACCEPTED SOLUTION

avatar
Master Collaborator

@snm1523 It should be SET FILEFORMAT INPUTFORMAT... Please try it as follows.

ALTER TABLE alter_file_format_test SET FILEFORMAT INPUTFORMAT 'org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat' OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat' SERDE 'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe';

View solution in original post

2 REPLIES 2

avatar
Master Collaborator

@snm1523 It should be SET FILEFORMAT INPUTFORMAT... Please try it as follows.

ALTER TABLE alter_file_format_test SET FILEFORMAT INPUTFORMAT 'org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat' OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat' SERDE 'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe';

avatar
Super Collaborator

@smruti - thank you for the response