<?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 [How?] Hive INSERT OVERWRITE to Transaction Table in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-Hive-INSERT-OVERWRITE-to-Transaction-Table/m-p/341261#M233471</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to execute "INSERT OVERWRITE" from managed table to Hive Transaction Table which is EMRFS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I tried was to first create managed table with s3 location (CSV), and executed the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;INSERT OVERWRITE TABLE tobe_tbl&lt;BR /&gt;SELECT * FROM asis_tbl LIMIT 10;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I got error as below:&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;Total jobs = 1&lt;BR /&gt;Launching Job 1 out of 1&lt;BR /&gt;FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.tez.TezTask&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I noticed that there was an error saying it is writing in Avro not ORC.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What commands or configurations could I make to properly INSERT OVERWRITE to Hive Transaction Table?&lt;/P&gt;</description>
    <pubDate>Tue, 12 Apr 2022 17:34:00 GMT</pubDate>
    <dc:creator>Trey</dc:creator>
    <dc:date>2022-04-12T17:34:00Z</dc:date>
    <item>
      <title>[How?] Hive INSERT OVERWRITE to Transaction Table</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-Hive-INSERT-OVERWRITE-to-Transaction-Table/m-p/341261#M233471</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to execute "INSERT OVERWRITE" from managed table to Hive Transaction Table which is EMRFS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I tried was to first create managed table with s3 location (CSV), and executed the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;INSERT OVERWRITE TABLE tobe_tbl&lt;BR /&gt;SELECT * FROM asis_tbl LIMIT 10;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I got error as below:&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;Total jobs = 1&lt;BR /&gt;Launching Job 1 out of 1&lt;BR /&gt;FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.tez.TezTask&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I noticed that there was an error saying it is writing in Avro not ORC.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What commands or configurations could I make to properly INSERT OVERWRITE to Hive Transaction Table?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 17:34:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-Hive-INSERT-OVERWRITE-to-Transaction-Table/m-p/341261#M233471</guid>
      <dc:creator>Trey</dc:creator>
      <dc:date>2022-04-12T17:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: [How?] Hive INSERT OVERWRITE to Transaction Table</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-Hive-INSERT-OVERWRITE-to-Transaction-Table/m-p/377449#M243268</link>
      <description>&lt;P&gt;Please share the complete stack-trace to get better context.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;To perform an INSERT OVERWRITE operation on a Hive ACID transactional table, you need to ensure that you have the right configuration and execute the query correctly. Here are the steps and configurations:&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Enable ACID Transactions&lt;/STRONG&gt;: Make sure your table is created with ACID properties. You can specify it during table creation like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CREATE TABLE my_table (
    -- Your table schema here
)
STORED AS ORC
TBLPROPERTIES ('transactional'='true');&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;If your table is not already transactional, you may need to create a new transactional table with the desired schema.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Set Hive ACID Properties&lt;/STRONG&gt;: You should set some Hive configuration properties to enable ACID transactions if they are not already set:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SET hive.support.concurrency=true;
SET hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
SET hive.compactor.initiator.on=true;
SET hive.compactor.worker.threads=1;  -- Number of compactor threads depending on the number of managed tables and usgae&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Perform the INSERT OVERWRITE:&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;Use the INSERT OVERWRITE statement to replace the data in the table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;INSERT OVERWRITE TABLE my_table
SELECT ...
FROM ...​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Ensure that the &lt;/SPAN&gt;SELECT&lt;SPAN&gt; statement fetches the data you want to overwrite with. You can use a &lt;/SPAN&gt;WHERE&lt;SPAN&gt; clause or other filters to specify the data you want to replace.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Enable Auto-Compaction :&lt;/STRONG&gt;&lt;SPAN&gt; You can enable auto-compaction to periodically clean up small files created by ACID transactions.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;REF -&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://docs.cloudera.com/HDPDocuments/HDP2/HDP-2.6.4/bk_data-access/content/ch02s05s01.html" target="_blank" rel="noopener"&gt;https://docs.cloudera.com/HDPDocuments/HDP2/HDP-2.6.4/bk_data-access/content/ch02s05s01.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.cloudera.com/HDPDocuments/HDP3/HDP-3.1.0/managing-hive/content/hive_acid_operations.html" target="_blank" rel="noopener"&gt;https://docs.cloudera.com/HDPDocuments/HDP3/HDP-3.1.0/managing-hive/content/hive_acid_operations.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.cloudera.com/HDPDocuments/HDP3/HDP-3.1.0/managing-hive/content/hive_hive_data_compaction.html" target="_blank" rel="noopener"&gt;https://docs.cloudera.com/HDPDocuments/HDP3/HDP-3.1.0/managing-hive/content/hive_hive_data_compaction.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 17:50:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-Hive-INSERT-OVERWRITE-to-Transaction-Table/m-p/377449#M243268</guid>
      <dc:creator>ggangadharan</dc:creator>
      <dc:date>2023-10-10T17:50:02Z</dc:date>
    </item>
  </channel>
</rss>

