Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-6365

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 converted back to table's fileformat after the insert operation.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None
    • emr

    Description

      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")
      .............

      1. 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")
      .................

      1. 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            pavan101 Pavan Srinivas
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: