Pavan Srinivas created HIVE-6365:
------------------------------------

             Summary: Alter a partition to be of a different fileformat than 
the Table's fileformat. Use insert overwrite to write data to this partition. 
The partition fileformat is coverted back to table's fileformat after the 
insert operation. 
                 Key: HIVE-6365
                 URL: https://issues.apache.org/jira/browse/HIVE-6365
             Project: Hive
          Issue Type: Bug
         Environment: emr
            Reporter: Pavan Srinivas


Lets say, there is partitioned table like 

Step1:
>> CREATE TABLE srcpart (key STRING, value STRING)
PARTITIONED BY (ds STRING, hr STRING)
STORED AS TEXTFILE;

Step2:
Alter the fileformat for a specific available partition. 
>> alter table srcpart partition(ds="2008-04-08", hr="12") set fileformat  orc;

Step3:
Describe the partition.
>> desc formatted srcpart partition(ds="2008-04-08", hr="12")
.............
# Storage Information
SerDe Library:          org.apache.hadoop.hive.ql.io.orc.OrcSerde
InputFormat:            org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
OutputFormat:           org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat
Compressed:             No
Num Buckets:            -1
Bucket Columns:         []
Sort Columns:           []
Storage Desc Params:
        serialization.format    1

Step4:
Write the data to this partition using insert overwrite. 
>>insert overwrite  table srcpart partition(ds="2008-04-08",hr="12") select 
>>key, value from ....... 

Step5:
Describe the partition again. 
>> desc formatted srcpart partition(ds="2008-04-08", hr="12")
.................
# Storage Information
SerDe Library:          org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
InputFormat:            org.apache.hadoop.mapred.TextInputFormat
OutputFormat:           
org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
Compressed:             No
Num Buckets:            -1
Bucket Columns:         []
Sort Columns:           []
Storage Desc Params:
        serialization.format    1



The fileformat of the partition is converted back to the table's original 
fileformat. It should have retained and written the data in the modified 
fileformat. 








--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to