title: Hadoop Combine Multiple part files into single file
body: <p>Currently I have</p>
  
  <p><code>part-00001 
   part-00002
  </code></p>
  
  <p>I know that using <code>hdfs -getmerge</code> is the best way to combine those files into a single one. However, is it possible to do it <strong>programmatically</strong>?</p>
  
  <p>I've tried using <a href="https://stackoverflow.com/questions/15346143/how-do-multiple-reducers-output-only-one-part-file-in-hadoop">MultipleOutput</a>, but it is not working. I've also tried writing my own <code>CustomOutputFormat</code> however due to multiple reducers during writing it to the file in parallel it gives <code>org.apache.hadoop.hdfs.server.namenode.LeaseExpiredException</code> error when closing the Dataoutputstream.</p>