drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From par...@apache.org
Subject drill git commit: DRILL-3583: Deprecate UserException#build method to avoid mishaps. This closes #123
Date Thu, 20 Aug 2015 21:56:14 GMT
Repository: drill
Updated Branches:
  refs/heads/master 718abac46 -> 3204df184


DRILL-3583: Deprecate UserException#build method to avoid mishaps. This
closes #123


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/3204df18
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/3204df18
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/3204df18

Branch: refs/heads/master
Commit: 3204df184416b93275b8db81a3067967878d07ac
Parents: 718abac
Author: Sudheesh Katkam <skatkam@maprtech.com>
Authored: Thu Aug 20 11:13:25 2015 -0700
Committer: Parth Chandra <parthc@apache.org>
Committed: Thu Aug 20 14:55:00 2015 -0700

----------------------------------------------------------------------
 .../apache/drill/common/exceptions/UserException.java  | 13 +++++++++++++
 .../exec/expr/fn/impl/AggregateErrorFunctions.java     |  9 ++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/3204df18/common/src/main/java/org/apache/drill/common/exceptions/UserException.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/exceptions/UserException.java b/common/src/main/java/org/apache/drill/common/exceptions/UserException.java
index b943710..b006fe3 100644
--- a/common/src/main/java/org/apache/drill/common/exceptions/UserException.java
+++ b/common/src/main/java/org/apache/drill/common/exceptions/UserException.java
@@ -38,6 +38,7 @@ import org.slf4j.Logger;
  * @see org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType
  */
 public class UserException extends DrillRuntimeException {
+  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(UserException.class);
 
   public static final String MEMORY_ERROR_MSG = "One or more nodes ran out of memory while
executing the query.";
 
@@ -534,6 +535,18 @@ public class UserException extends DrillRuntimeException {
 
       return newException;
     }
+
+    /**
+     * Builds a user exception or returns the wrapped one.
+     *
+     * @return user exception
+     * @deprecated Use {@link #build(Logger)} instead. If the error is a system error, the
error message is logged to
+     * this {@link UserException#logger}.
+     */
+    @Deprecated
+    public UserException build() {
+      return build(logger);
+    }
   }
 
   private final DrillPBError.ErrorType errorType;

http://git-wip-us.apache.org/repos/asf/drill/blob/3204df18/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/AggregateErrorFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/AggregateErrorFunctions.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/AggregateErrorFunctions.java
index 0a9ef8d..3c270a0 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/AggregateErrorFunctions.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/AggregateErrorFunctions.java
@@ -34,7 +34,6 @@ import org.apache.drill.exec.expr.holders.VarCharHolder;
  * to perform function resolution. Otherwise with implicit cast we will try to bind to an
existing function.
  */
 public class AggregateErrorFunctions {
-  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AggregateErrorFunctions.class);
 
   @FunctionTemplate(names = {"sum", "max", "avg", "stddev_pop", "stddev_samp", "stddev",
"var_pop",
       "var_samp", "variance"}, scope = FunctionTemplate.FunctionScope.POINT_AGGREGATE)
@@ -48,7 +47,7 @@ public class AggregateErrorFunctions {
       if (true) {
         throw org.apache.drill.common.exceptions.UserException.unsupportedError()
           .message("Only COUNT aggregate function supported for Boolean type")
-          .build(logger);
+          .build();
       }
     }
 
@@ -78,7 +77,7 @@ public class AggregateErrorFunctions {
       if (true) {
         throw org.apache.drill.common.exceptions.UserException.unsupportedError()
           .message("Only COUNT aggregate function supported for Boolean type")
-          .build(logger);
+          .build();
       }
     }
 
@@ -108,7 +107,7 @@ public class AggregateErrorFunctions {
       if (true) {
         throw org.apache.drill.common.exceptions.UserException.unsupportedError()
           .message("Only COUNT, MIN and MAX aggregate functions supported for VarChar type")
-          .build(logger);
+          .build();
       }
     }
 
@@ -138,7 +137,7 @@ public class AggregateErrorFunctions {
       if (true) {
         throw org.apache.drill.common.exceptions.UserException.unsupportedError()
           .message("Only COUNT, MIN and MAX aggregate functions supported for VarChar type")
-          .build(logger);
+          .build();
       }
     }
 


Mime
View raw message