title: Hive query failing on INSERT OVERWRITE
body: <p>I'm running queries on hive(v 0.11) using jdbc connection. The code is as follows : </p>
  
  <pre><code>Connection con = DriverManager.getConnection(
                  "jdbc:hive://192.168.1.10:10000", "", "");
  Statement stmt = con.createStatement();
  stmt.execute("some query");
  </code></pre>
  
  <p>It runs the following queries successfully:</p>
  
  <pre><code>CREATE TABLE testdb.test(name string,id int);
  
  SELECT * FROM testdb.test;
  </code></pre>
  
  <p>However fails on executing any queries containing INSERT OVERWRITE clause. Eg:</p>
  
  <pre><code>INSERT OVERWRITE DIRECTORY '/user/jim/dir' SELECT * FROM space.test;
  
  INSERT OVERWRITE TABLE testdb.t2 select name,id from testdb.test;
  </code></pre>
  
  <p>with following trace :</p>
  
  <pre><code>java.sql.SQLException: Query returned non-zero code: 1, cause: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MapRedTask
  at org.apache.hadoop.hive.jdbc.HivePreparedStatement.executeImmediate(HivePreparedStatement.java:178)
  at org.apache.hadoop.hive.jdbc.HivePreparedStatement.executeQuery(HivePreparedStatement.java:141)
  at my.pack.test.HiveTest.main(HiveTest.java:31)
    Caused by: HiveServerException(message:Query returned non-zero code: 1, cause: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MapRedTask, errorCode:1, SQLState:08S01)
  at org.apache.hadoop.hive.service.ThriftHive$execute_result$execute_resultStandardScheme.read(ThriftHive.java:1494)
  at org.apache.hadoop.hive.service.ThriftHive$execute_result$execute_resultStandardScheme.read(ThriftHive.java:1480)
  at org.apache.hadoop.hive.service.ThriftHive$execute_result.read(ThriftHive.java:1430)
  at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
  at org.apache.hadoop.hive.service.ThriftHive$Client.recv_execute(ThriftHive.java:116)
  at org.apache.hadoop.hive.service.ThriftHive$Client.execute(ThriftHive.java:103)
  at org.apache.hadoop.hive.jdbc.HivePreparedStatement.executeImmediate(HivePreparedStatement.java:176)
  ... 2 more
  </code></pre>
  
  <p>The main problem is that these queries can be executed from the hive console successfully. </p>
  
  <p>Please help anyone if I'm missing something here. Or there is some better way to achieve this with jdbc ?</p>
  
  <p>N.B. - Each queries in the above blocks are executed separately without the semicolon. I just put them for ease in readability.    </p>