Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: The Cloudera Community will undergo maintenance on Saturday, August 17 at 12:00am PDT. See more info here.

Specifying a different format for partition

Specifying a different format for partition

Hi,

I know that it is possible to have one inputformat at the table level and another at the partition level (mixed formats table) but I can't see anything in the docs stating how to accomplish that.

I tried that following statement but it failed:

hive> alter table test_tbl_parquet add partition (year=2016,month=01,day=27)
    >  ROW FORMAT DELIMITED
    > FIELDS TERMINATED BY '\u0001'
    > STORED AS INPUTFORMAT
    >   'com.mycopmany.hive.WhaleAvroGenericInputFormat'
    > OUTPUTFORMAT
    >   'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
    >  location '/mycopmany/data/test_tbl/year=2016/month=01/day=27';
FAILED: ParseException line 1:90 missing EOF at 'ROW' near ')'
 
Any ideas what is the correct syntax?
 
Thank you.
Daniel
1 REPLY 1

Re: Specifying a different format for partition

Master Guru
The ALTER TABLE … PARTITION syntax does not accept the extra arguments you are trying to pass: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-AlterPartition

AFAIK, the feature of different SerDe config between table and partition level only works in the inverse manner: You can change the table's configuration of SerDe/InputFormat/OutputFormat after having previously created multiple partitions under a different configuration, but not vice-versa (as you are looking to do). As one workaround you can change it at the table level, create your partition regularly, then change it back again at the table level.