tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hyun...@apache.org
Subject git commit: TAJO-372: When an exception except for network issues occurs, the operation should not be repeated.
Date Mon, 27 Jan 2014 11:36:51 GMT
Updated Branches:
  refs/heads/master 5ac8c77cd -> 106d29c2d


TAJO-372: When an exception except for network issues occurs, the operation should not be
repeated.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tajo/commit/106d29c2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tajo/tree/106d29c2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tajo/diff/106d29c2

Branch: refs/heads/master
Commit: 106d29c2d9c0cb89bac3ab4efcdce1a0f2abb2fe
Parents: 5ac8c77
Author: Hyunsik Choi <hyunsik@apache.org>
Authored: Mon Jan 27 20:36:29 2014 +0900
Committer: Hyunsik Choi <hyunsik@apache.org>
Committed: Mon Jan 27 20:36:29 2014 +0900

----------------------------------------------------------------------
 CHANGES.txt                                            |  5 ++++-
 .../org/apache/tajo/catalog/AbstractCatalogClient.java |  4 ++--
 .../main/java/org/apache/tajo/catalog/CatalogUtil.java |  2 +-
 .../catalog/exception/NoSuchFunctionException.java     | 13 ++++++++++---
 .../java/org/apache/tajo/catalog/TestCatalogUtil.java  |  5 ++---
 .../java/org/apache/tajo/catalog/CatalogServer.java    |  8 ++++----
 .../org/apache/tajo/engine/planner/ExprAnnotator.java  | 12 +++++-------
 .../queries/TestJoinQuery/testWhereClauseJoin6.sql     |  2 +-
 .../main/java/org/apache/tajo/rpc/AsyncRpcServer.java  |  2 +-
 .../main/java/org/apache/tajo/rpc/ServerCallable.java  | 10 ++++++----
 10 files changed, 36 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/106d29c2/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 0f82e9b..1ea0718 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -231,7 +231,10 @@ Release 0.8.0 - unreleased
 
   BUG FIXES
 
-    TAJO-552: Fix Bug verify-protocbuf.sh runs with bash. 
+    TAJO-372: When an exception except for network issues occurs, the
+    operation should not be repeated. (hyunsik)
+
+    TAJO-552: Fix Bug verify-protocbuf.sh runs with bash.
     (DaeMyung Kang via jihoon)
 
     TAJO-551: Fix bug getFunction can get wrong function that have invalid 

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/106d29c2/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java
b/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java
index 9176a88..c711deb 100644
--- a/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java
+++ b/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java
@@ -368,14 +368,14 @@ public abstract class AbstractCatalogClient implements CatalogService
{
     }
 
     if (descProto == null) {
-      throw new NoSuchFunctionException(signature);
+      throw new NoSuchFunctionException(signature, paramTypes);
     }
 
     try {
       return new FunctionDesc(descProto);
     } catch (ClassNotFoundException e) {
       LOG.error(e);
-      throw new NoSuchFunctionException(signature);
+      throw new NoSuchFunctionException(signature, paramTypes);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/106d29c2/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
index 4a3fc27..95bd83d 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
@@ -46,7 +46,7 @@ public class CatalogUtil {
     sb.append("(");
     int i = 0;
     for (DataType type : paramTypes) {
-      sb.append(type.getType());
+      sb.append(type.getType().name().toLowerCase());
       if(i < paramTypes.length - 1) {
         sb.append(",");
       }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/106d29c2/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchFunctionException.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchFunctionException.java
b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchFunctionException.java
index fba8d09..7765c31 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchFunctionException.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchFunctionException.java
@@ -18,12 +18,19 @@
 
 package org.apache.tajo.catalog.exception;
 
+import org.apache.tajo.catalog.CatalogUtil;
+import org.apache.tajo.common.TajoDataTypes;
+
+import java.util.Collection;
+
 public class NoSuchFunctionException extends RuntimeException {
 	private static final long serialVersionUID = 5062193018697228028L;
 
-	public NoSuchFunctionException() {}
+  public NoSuchFunctionException(String funcName, TajoDataTypes.DataType [] parameters) {
+    super("function " + CatalogUtil.getCanonicalName(funcName, parameters) + " does not exist");
+  }
 
-	public NoSuchFunctionException(String funcName) {
-		super("No Such GeneralFunction in Catalog: "+funcName);
+	public NoSuchFunctionException(String funcName, Collection<TajoDataTypes.DataType>
parameters) {
+		super("function " + CatalogUtil.getCanonicalName(funcName, parameters) + " does not exist");
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/106d29c2/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestCatalogUtil.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestCatalogUtil.java
b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestCatalogUtil.java
index bda98db..065ec9d 100644
--- a/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestCatalogUtil.java
+++ b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestCatalogUtil.java
@@ -26,8 +26,7 @@ import static org.junit.Assert.assertEquals;
 public class TestCatalogUtil {
   @Test
   public final void testGetCanonicalName() {
-    String canonical = CatalogUtil.getCanonicalName("sum",
-        CatalogUtil.newSimpleDataTypeArray(Type.INT4, Type.INT8));
-    assertEquals("sum(INT4,INT8)", canonical);
+    String canonical = CatalogUtil.getCanonicalName("sum", CatalogUtil.newSimpleDataTypeArray(Type.INT4,
Type.INT8));
+    assertEquals("sum(int4,int8)", canonical);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/106d29c2/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
index 5d01a16..abc3832 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
@@ -508,7 +508,7 @@ public class CatalogServer extends AbstractService {
           }
         }
       }
-      throw new NoSuchFunctionException(signature);
+      throw new NoSuchFunctionException(signature, params);
     }
 
     private FunctionDescProto findFunction(String signature, FunctionType type, List<DataType>
params) {
@@ -519,7 +519,7 @@ public class CatalogServer extends AbstractService {
           }
         }
       }
-      throw new NoSuchFunctionException(signature);
+      throw new NoSuchFunctionException(signature, params);
     }
 
     private FunctionDescProto findFunction(FunctionDescProto target) {
@@ -555,7 +555,7 @@ public class CatalogServer extends AbstractService {
         throws ServiceException {
 
       if (!containFunction(request.getSignature())) {
-        throw new NoSuchFunctionException(request.getSignature());
+        throw new NoSuchFunctionException(request.getSignature(), new DataType[] {});
       }
 
       functions.remove(request.getSignature());
@@ -573,7 +573,7 @@ public class CatalogServer extends AbstractService {
               request.getParameterTypesList());
           return desc;
         }
-        throw new NoSuchFunctionException(request.getSignature());
+        throw new NoSuchFunctionException(request.getSignature(), request.getParameterTypesList());
       } else {
         FunctionDescProto function = findFunction(request.getSignature(), request.getParameterTypesList());
         return function;

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/106d29c2/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/ExprAnnotator.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/ExprAnnotator.java
b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/ExprAnnotator.java
index ffa8f7a..c90325a 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/ExprAnnotator.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/ExprAnnotator.java
@@ -390,12 +390,12 @@ public class ExprAnnotator extends BaseAlgebraVisitor<ExprAnnotator.Context,
Eva
     stack.pop(); // <--- Pop
 
     if (!catalog.containFunction(expr.getSignature(), paramTypes)) {
-      throw new NoSuchFunctionException(CatalogUtil.getCanonicalName(expr.getSignature(),
paramTypes));
+      throw new NoSuchFunctionException(expr.getSignature(), paramTypes);
     }
 
     FunctionDesc funcDesc = catalog.getFunction(expr.getSignature(), paramTypes);
     if (funcDesc == null) {
-      throw new NoSuchFunctionException(CatalogUtil.getCanonicalName(expr.getSignature(),
paramTypes));
+      throw new NoSuchFunctionException(expr.getSignature(), paramTypes);
     }
     try {
     CatalogProtos.FunctionType functionType = funcDesc.getFuncType();
@@ -429,8 +429,7 @@ public class ExprAnnotator extends BaseAlgebraVisitor<ExprAnnotator.Context,
Eva
     FunctionDesc countRows = catalog.getFunction("count", CatalogProtos.FunctionType.AGGREGATION,
         new TajoDataTypes.DataType[] {});
     if (countRows == null) {
-      throw new NoSuchFunctionException(CatalogUtil.
-          getCanonicalName(countRows.getSignature(), new TajoDataTypes.DataType[]{}));
+      throw new NoSuchFunctionException(countRows.getSignature(), new TajoDataTypes.DataType[]{});
     }
 
     try {
@@ -439,8 +438,7 @@ public class ExprAnnotator extends BaseAlgebraVisitor<ExprAnnotator.Context,
Eva
       return new AggregationFunctionCallEval(countRows, (AggFunction) countRows.newInstance(),
           new EvalNode[] {});
     } catch (InternalException e) {
-      throw new NoSuchFunctionException(CatalogUtil.
-          getCanonicalName(countRows.getSignature(), new TajoDataTypes.DataType[]{}));
+      throw new NoSuchFunctionException(countRows.getSignature(), new TajoDataTypes.DataType[]{});
     }
   }
 
@@ -462,7 +460,7 @@ public class ExprAnnotator extends BaseAlgebraVisitor<ExprAnnotator.Context,
Eva
     }
 
     if (!catalog.containFunction(setFunction.getSignature(), functionType, paramTypes)) {
-      throw new NoSuchFunctionException(CatalogUtil. getCanonicalName(setFunction.getSignature(),
paramTypes));
+      throw new NoSuchFunctionException(setFunction.getSignature(), paramTypes);
     }
 
     FunctionDesc funcDesc = catalog.getFunction(setFunction.getSignature(), functionType,
paramTypes);

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/106d29c2/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testWhereClauseJoin6.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testWhereClauseJoin6.sql
b/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testWhereClauseJoin6.sql
index 3993462..62d3b79 100644
--- a/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testWhereClauseJoin6.sql
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testWhereClauseJoin6.sql
@@ -2,7 +2,7 @@ select
 	s_acctbal,
 	s_name,
 	p_partkey,
-	n_name,
+	n_name
 from
 	part,
 	supplier,

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/106d29c2/tajo-rpc/src/main/java/org/apache/tajo/rpc/AsyncRpcServer.java
----------------------------------------------------------------------
diff --git a/tajo-rpc/src/main/java/org/apache/tajo/rpc/AsyncRpcServer.java b/tajo-rpc/src/main/java/org/apache/tajo/rpc/AsyncRpcServer.java
index 5cf830e..4dc1d05 100644
--- a/tajo-rpc/src/main/java/org/apache/tajo/rpc/AsyncRpcServer.java
+++ b/tajo-rpc/src/main/java/org/apache/tajo/rpc/AsyncRpcServer.java
@@ -118,7 +118,7 @@ public class AsyncRpcServer extends NettyServerBase {
         RemoteCallException callException = (RemoteCallException) e.getCause();
         e.getChannel().write(callException.getResponse());
       }
-      throw new RemoteException(e.getCause());
+      throw new RemoteException(serviceName, e.getCause());
     }
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/106d29c2/tajo-rpc/src/main/java/org/apache/tajo/rpc/ServerCallable.java
----------------------------------------------------------------------
diff --git a/tajo-rpc/src/main/java/org/apache/tajo/rpc/ServerCallable.java b/tajo-rpc/src/main/java/org/apache/tajo/rpc/ServerCallable.java
index 143c9f7..3f724e8 100644
--- a/tajo-rpc/src/main/java/org/apache/tajo/rpc/ServerCallable.java
+++ b/tajo-rpc/src/main/java/org/apache/tajo/rpc/ServerCallable.java
@@ -94,18 +94,20 @@ public abstract class ServerCallable<T> {
           client = RpcConnectionPool.getPool(tajoConf).getConnection(addr, protocol, asyncMode);
         }
         return call(client);
-      } catch (Throwable t) {
+      } catch (IOException ioe) {
         if(!closeConn) {
           RpcConnectionPool.getPool(tajoConf).closeConnection(client);
           client = null;
         }
-        exceptions.add(t);
+        exceptions.add(ioe);
         if(abort) {
-          throw new ServiceException(t.getMessage(), t);
+          throw new ServiceException(ioe.getMessage(), ioe);
         }
         if (tries == numRetries - 1) {
-          throw new ServiceException("Giving up after tries=" + tries, t);
+          throw new ServiceException("Giving up after tries=" + tries, ioe);
         }
+      } catch (Throwable t) {
+        throw new ServiceException(t);
       } finally {
         afterCall();
         if(closeConn) {


Mime
View raw message