hadoop-hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmur...@apache.org
Subject svn commit: r796710 - in /hadoop/hive/trunk: ./ cli/src/java/org/apache/hadoop/hive/cli/ data/files/ hwi/src/java/org/apache/hadoop/hive/hwi/ ql/src/java/org/apache/hadoop/hive/ql/ ql/src/java/org/apache/hadoop/hive/ql/exec/ ql/src/test/org/apache/hado...
Date Wed, 22 Jul 2009 13:25:03 GMT
Author: rmurthy
Date: Wed Jul 22 13:25:03 2009
New Revision: 796710

URL: http://svn.apache.org/viewvc?rev=796710&view=rev
Log:
HIVE-666. Propagate errors in FetchTask to client.
(Zheng Shao via rmurthy)


Added:
    hadoop/hive/trunk/data/files/kv1_broken.seq   (with props)
    hadoop/hive/trunk/ql/src/test/queries/clientnegative/fetchtask_ioexception.q
    hadoop/hive/trunk/ql/src/test/results/clientnegative/fetchtask_ioexception.q.out
Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java
    hadoop/hive/trunk/hwi/src/java/org/apache/hadoop/hive/hwi/HWISessionItem.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchOperator.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchTask.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Task.java
    hadoop/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java
    hadoop/hive/trunk/service/src/java/org/apache/hadoop/hive/service/HiveServer.java

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=796710&r1=796709&r2=796710&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Wed Jul 22 13:25:03 2009
@@ -397,6 +397,9 @@
     HIVE-654. renaming thrift serde
     (Zheng Shao via namit)
 
+    HIVE-666. Propagate errors in FetchTask to client.
+    (Zheng Shao via rmurthy)
+
 Release 0.3.1 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/hive/trunk/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java?rev=796710&r1=796709&r2=796710&view=diff
==============================================================================
--- hadoop/hive/trunk/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java (original)
+++ hadoop/hive/trunk/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java Wed Jul 22 13:25:03
2009
@@ -126,18 +126,26 @@
           }
         
           Vector<String> res = new Vector<String>();
-          while (qp.getResults(res)) {
-            for (String r:res) {
-              out.println(r);
-            }
-            res.clear();
-            if (out.checkError()) {
-              break;
+          try {
+            while (qp.getResults(res)) {
+              for (String r:res) {
+                out.println(r);
+              }
+              res.clear();
+              if (out.checkError()) {
+                break;
+              }
             }
+          } catch (IOException e) {
+            console.printError("Failed with exception " + e.getClass().getName() + ":" +
  e.getMessage(),
+                "\n" + org.apache.hadoop.util.StringUtils.stringifyException(e));
+            ret = 1;
           }
-      
+            
           int cret = qp.close();
-          ret = cret;
+          if (ret == 0) {
+            ret = cret;
+          }
 
           long end = System.currentTimeMillis();
           if (end > start) {

Added: hadoop/hive/trunk/data/files/kv1_broken.seq
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/data/files/kv1_broken.seq?rev=796710&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/hive/trunk/data/files/kv1_broken.seq
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: hadoop/hive/trunk/hwi/src/java/org/apache/hadoop/hive/hwi/HWISessionItem.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/hwi/src/java/org/apache/hadoop/hive/hwi/HWISessionItem.java?rev=796710&r1=796709&r2=796710&view=diff
==============================================================================
--- hadoop/hive/trunk/hwi/src/java/org/apache/hadoop/hive/hwi/HWISessionItem.java (original)
+++ hadoop/hive/trunk/hwi/src/java/org/apache/hadoop/hive/hwi/HWISessionItem.java Wed Jul
22 13:25:03 2009
@@ -298,14 +298,19 @@
 
 		queryRet = qp.run(this.query);
 		Vector<String> res = new Vector<String>();
-		while (qp.getResults(res)) {
-			for (String row : res) {
-				if (ss.out != null) {
-					ss.out.println(row);
-				}
-			}
-			res.clear();
-		}
+    try {
+  		while (qp.getResults(res)) {
+  			for (String row : res) {
+  				if (ss.out != null) {
+  					ss.out.println(row);
+  				}
+  			}
+  			res.clear();
+  		}
+    } catch (IOException ex) {
+      l4j.error(this.getSessionName() + " getting results "
+          + this.getResultFile() + " caused exception.", ex);
+    }
 		try {
 			if (fos != null) {
 				fos.close();

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java?rev=796710&r1=796709&r2=796710&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java Wed Jul 22 13:25:03
2009
@@ -384,7 +384,7 @@
     return (0);
   }
 
-  public boolean getResults(Vector<String> res) {
+  public boolean getResults(Vector<String> res) throws IOException {
     if (plan != null && plan.getPlan().getFetchTask() != null) {
       BaseSemanticAnalyzer sem = plan.getPlan();
       if (!sem.getFetchTaskInit()) {

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchOperator.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchOperator.java?rev=796710&r1=796709&r2=796710&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchOperator.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchOperator.java Wed Jul
22 13:25:03 2009
@@ -245,7 +245,7 @@
    * @param ctx
    *          fetch context
    **/
-  public InspectableObject getNextRow() {
+  public InspectableObject getNextRow() throws IOException {
     try {
       if (currRecReader == null) {
         currRecReader = getRecordReader();
@@ -272,7 +272,7 @@
           return getNextRow();
       }
     } catch (Exception e) {
-      return null;
+      throw new IOException(e);
     }
   }
 

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchTask.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchTask.java?rev=796710&r1=796709&r2=796710&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchTask.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchTask.java Wed Jul 22
13:25:03 2009
@@ -118,7 +118,7 @@
     this.maxRows = maxRows;
   }
 	
-  public boolean fetch(Vector<String> res) {
+  public boolean fetch(Vector<String> res) throws IOException {
     try {
       int numRows = 0;
       int rowsRet = maxRows;
@@ -144,9 +144,11 @@
       totalRows += numRows;
       return true;
     }
+    catch (IOException e) {
+      throw e;
+    }
     catch (Exception e) {
-      console.printError("Failed with exception " + e.getClass().getName() + ":" +   e.getMessage(),
"\n" + StringUtils.stringifyException(e));
-      return false;
+      throw new IOException(e);
     }
   }
 }

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Task.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Task.java?rev=796710&r1=796709&r2=796710&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Task.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Task.java Wed Jul 22 13:25:03
2009
@@ -80,7 +80,7 @@
   public abstract int execute();
   
   // dummy method - FetchTask overwrites this
-  public boolean fetch(Vector<String> res) { 
+  public boolean fetch(Vector<String> res) throws IOException { 
     assert false;
   	return false;
   }

Modified: hadoop/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java?rev=796710&r1=796709&r2=796710&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java (original)
+++ hadoop/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java Wed Jul 22 13:25:03
2009
@@ -264,7 +264,8 @@
     for(String s: new String [] {"src", "src1", "src_json", "src_thrift", "src_sequencefile",

                                  "srcpart", "srcbucket", "dest1", "dest2", 
                                  "dest3", "dest4", "dest4_sequencefile",
-                                 "dest_j1", "dest_j2", "dest_g1", "dest_g2"}) {
+                                 "dest_j1", "dest_j2", "dest_g1", "dest_g2",
+                                 "fetchtask_ioexception"}) {
       db.dropTable(MetaStoreUtils.DEFAULT_DATABASE_NAME, s);
     }
     for(String s: new String [] {"dest4.out", "union.out"}) {

Added: hadoop/hive/trunk/ql/src/test/queries/clientnegative/fetchtask_ioexception.q
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/queries/clientnegative/fetchtask_ioexception.q?rev=796710&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/queries/clientnegative/fetchtask_ioexception.q (added)
+++ hadoop/hive/trunk/ql/src/test/queries/clientnegative/fetchtask_ioexception.q Wed Jul 22
13:25:03 2009
@@ -0,0 +1,7 @@
+CREATE TABLE fetchtask_ioexception (
+  KEY STRING,
+  VALUE STRING) STORED AS SEQUENCEFILE;
+
+LOAD DATA LOCAL INPATH '../data/files/kv1_broken.seq' OVERWRITE INTO TABLE fetchtask_ioexception;
+
+SELECT * FROM fetchtask_ioexception;

Added: hadoop/hive/trunk/ql/src/test/results/clientnegative/fetchtask_ioexception.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientnegative/fetchtask_ioexception.q.out?rev=796710&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientnegative/fetchtask_ioexception.q.out (added)
+++ hadoop/hive/trunk/ql/src/test/results/clientnegative/fetchtask_ioexception.q.out Wed Jul
22 13:25:03 2009
@@ -0,0 +1,8 @@
+query: CREATE TABLE fetchtask_ioexception (
+  KEY STRING,
+  VALUE STRING) STORED AS SEQUENCEFILE
+query: LOAD DATA LOCAL INPATH '../data/files/kv1_broken.seq' OVERWRITE INTO TABLE fetchtask_ioexception
+query: SELECT * FROM fetchtask_ioexception
+Input: default/fetchtask_ioexception
+Output: file:/data/users/zshao/tools/deploy-trunk-apache-hive/build/ql/tmp/1939498833/10000
+Failed with exception java.io.IOException:java.io.EOFException

Modified: hadoop/hive/trunk/service/src/java/org/apache/hadoop/hive/service/HiveServer.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/service/src/java/org/apache/hadoop/hive/service/HiveServer.java?rev=796710&r1=796709&r2=796710&view=diff
==============================================================================
--- hadoop/hive/trunk/service/src/java/org/apache/hadoop/hive/service/HiveServer.java (original)
+++ hadoop/hive/trunk/service/src/java/org/apache/hadoop/hive/service/HiveServer.java Wed
Jul 22 13:25:03 2009
@@ -18,6 +18,7 @@
 
 package org.apache.hadoop.hive.service;
 
+import java.io.IOException;
 import java.util.List;
 import java.util.Vector;
 
@@ -143,13 +144,17 @@
     public String fetchOne() throws HiveServerException, TException {
       driver.setMaxRows(1);
       Vector<String> result = new Vector<String>();
-      if (driver.getResults(result)) {
-        return result.get(0);
+      try {
+        if (driver.getResults(result)) {
+          return result.get(0);
+        }
+        // TODO: Cannot return null here because thrift cannot handle nulls
+        // TODO: Returning empty string for now. Need to figure out how to
+        // TODO: return null in some other way
+        return "";
+      } catch (IOException e) {
+        throw new HiveServerException(e.getMessage());
       }
-      // TODO: Cannot return null here because thrift cannot handle nulls
-      // TODO: Returning empty string for now. Need to figure out how to
-      // TODO: return null in some other way
-      return "";
     }
 
     /**
@@ -168,7 +173,11 @@
       } 
       Vector<String> result = new Vector<String>();
       driver.setMaxRows(numRows);
-      driver.getResults(result);
+      try {
+        driver.getResults(result);
+      } catch (IOException e) {
+        throw new HiveServerException(e.getMessage());
+      }
       return result;
     }
 
@@ -183,9 +192,13 @@
     public List<String> fetchAll() throws HiveServerException, TException {
       Vector<String> rows = new Vector<String>();
       Vector<String> result = new Vector<String>();
-      while (driver.getResults(result)) {
-        rows.addAll(result);
-        result.clear();
+      try {
+        while (driver.getResults(result)) {
+          rows.addAll(result);
+          result.clear();
+        }
+      } catch (IOException e) {
+        throw new HiveServerException(e.getMessage());
       }
       return rows;
     }



Mime
View raw message