<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Change default Hive compression codec in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Change-default-Hive-compression-codec/m-p/90134#M35238</link>
    <description>&lt;P&gt;Hi Cloudera Community ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How i can change&amp;nbsp; the compression codec of hive&amp;nbsp;at runtime. I'm reading some table on avro format compressed with snappy and i'm triying to write a similiar table compressed on snappy but the result is compressed on "deflate", after try with multiple options the resulting files were compressed with the same codec.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me to identify my issue on the following sentences, or what can i do to define the compression codec of hive at runtime.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;"set hive.exec.compress.output=true;&lt;BR /&gt;SET mapred.output.compression.codec=org.apache.hadoop.io.compress.SnappyCodec;&lt;BR /&gt;SET mapred.output.compression.type=BLOCK;&lt;BR /&gt;SET hive.exec.dynamic.partition.mode=nonstrict;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CREATE external table IF NOT EXISTS tableX partitioned by (year Int)&lt;BR /&gt;ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.avro.AvroSerDe'&lt;BR /&gt;STORED AS INPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat'&lt;BR /&gt;OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat'&lt;BR /&gt;TBLPROPERTIES ('avro.schema.url'='hdfs:///AAA/BBB/CCC/tableX.avsc');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;alter table tableX add if not exists partition (year = 2016)&lt;BR /&gt;location 'hdfs://nameservice/AAA/BBB/CCC/2016';&lt;/P&gt;&lt;P&gt;insert overwrite table tableX partition (year = 2016) SELECT&lt;BR /&gt;id, name, email&lt;BR /&gt;FROM tablaY WHERE year = 2016;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Esteban&lt;/P&gt;</description>
    <pubDate>Fri, 16 Sep 2022 14:22:40 GMT</pubDate>
    <dc:creator>EstebanGonzalez</dc:creator>
    <dc:date>2022-09-16T14:22:40Z</dc:date>
    <item>
      <title>Change default Hive compression codec</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Change-default-Hive-compression-codec/m-p/90134#M35238</link>
      <description>&lt;P&gt;Hi Cloudera Community ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How i can change&amp;nbsp; the compression codec of hive&amp;nbsp;at runtime. I'm reading some table on avro format compressed with snappy and i'm triying to write a similiar table compressed on snappy but the result is compressed on "deflate", after try with multiple options the resulting files were compressed with the same codec.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me to identify my issue on the following sentences, or what can i do to define the compression codec of hive at runtime.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;"set hive.exec.compress.output=true;&lt;BR /&gt;SET mapred.output.compression.codec=org.apache.hadoop.io.compress.SnappyCodec;&lt;BR /&gt;SET mapred.output.compression.type=BLOCK;&lt;BR /&gt;SET hive.exec.dynamic.partition.mode=nonstrict;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CREATE external table IF NOT EXISTS tableX partitioned by (year Int)&lt;BR /&gt;ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.avro.AvroSerDe'&lt;BR /&gt;STORED AS INPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat'&lt;BR /&gt;OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat'&lt;BR /&gt;TBLPROPERTIES ('avro.schema.url'='hdfs:///AAA/BBB/CCC/tableX.avsc');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;alter table tableX add if not exists partition (year = 2016)&lt;BR /&gt;location 'hdfs://nameservice/AAA/BBB/CCC/2016';&lt;/P&gt;&lt;P&gt;insert overwrite table tableX partition (year = 2016) SELECT&lt;BR /&gt;id, name, email&lt;BR /&gt;FROM tablaY WHERE year = 2016;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Esteban&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 14:22:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Change-default-Hive-compression-codec/m-p/90134#M35238</guid>
      <dc:creator>EstebanGonzalez</dc:creator>
      <dc:date>2022-09-16T14:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: Change default Hive compression codec</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Change-default-Hive-compression-codec/m-p/90185#M35239</link>
      <description>Quoted from documentation about using Avro files at &lt;A href="https://www.cloudera.com/documentation/enterprise/latest/topics/cdh_ig_avro_usage.html#topic_26_2" target="_blank"&gt;https://www.cloudera.com/documentation/enterprise/latest/topics/cdh_ig_avro_usage.html#topic_26_2&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;"""&lt;BR /&gt;Hive&lt;BR /&gt;(…)&lt;BR /&gt;To enable Snappy compression on output [avro] files, run the following before writing to the table:&lt;BR /&gt;&lt;BR /&gt;SET hive.exec.compress.output=true;&lt;BR /&gt;SET avro.output.codec=snappy;&lt;BR /&gt;"""&lt;BR /&gt;&lt;BR /&gt;Please try this out. You're missing only the second property mentioned here, which appears specific to Avro serialization in Hive.&lt;BR /&gt;&lt;BR /&gt;Default compression of Avro is deflate, so that explains the behaviour you observe without it.</description>
      <pubDate>Thu, 09 May 2019 09:09:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Change-default-Hive-compression-codec/m-p/90185#M35239</guid>
      <dc:creator>Harsh J</dc:creator>
      <dc:date>2019-05-09T09:09:18Z</dc:date>
    </item>
  </channel>
</rss>

