title: Insert overwrite partition in Hive table - Values getting duplicated
body: <p>I created a Hive table with <strong>Non-partition</strong> table and using select query I inserted data into <strong>Partitioned</strong> Hive table.</p>
  
  <p><a href="https://blog.safaribooksonline.com/2012/12/03/tip-partitioning-data-in-hive/" rel="nofollow">Refered site</a></p>
  
  <ol>
  <li><strong>By following above link my partition table contains duplicate values. Below are the setps</strong></li>
  </ol>
  
  <p>This is my Sample employee dataset:<a href="http://pastebin.com/tVh16Yxt" rel="nofollow">link1</a></p>
  
  <p>I tried the following queries: <a href="http://pastebin.com/U2yykWpy" rel="nofollow">link2</a></p>
  
  <p>But after updating a value in Hive table,</p>
  
  <p>Updating salary of Steven with EmployeeID 19 to 50000.</p>
  
  <blockquote>
    <p>INSERT OVERWRITE TABLE Unm_Parti_Trail PARTITION (Department = 'A')
    SELECT employeeid,firstname,designation, CASE WHEN employeeid=19 THEN
    50000 ELSE salary END AS salary FROM Unm_Parti_Trail;</p>
  </blockquote>
  
  <p>the values are getting duplicated.</p>
  
  <pre><code>7       Nirmal  Tech    12000   A
  7       Nirmal  Tech    12000   B
  </code></pre>
  
  <p>Nirmal is placed in Department <strong>A</strong> only but it is duplicated to department <strong>B</strong>.</p>
  
  <p>Am I doing anything wrong?</p>
  
  <p>Please suggest.</p>