You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jh...@apache.org on 2015/09/02 02:09:45 UTC

[09/18] incubator-calcite git commit: Lazily create exception only when it needs to be thrown (Marc Prud'hommeaux)

Lazily create exception only when it needs to be thrown (Marc Prud'hommeaux)

Exceptions are expensive to create, so don't create a RuntimeException()
unless we are actually going to throw something.

Close apache/incubator-calcite#117


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

Branch: refs/heads/master
Commit: a5688ffc007d3dc15594238e69ec0b2e806358d3
Parents: 54249d0
Author: Marc Prud'hommeaux <mw...@cornell.edu>
Authored: Wed Aug 5 20:35:40 2015 -0400
Committer: Julian Hyde <jh...@apache.org>
Committed: Tue Sep 1 16:17:15 2015 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a5688ffc/core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java b/core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java
index 144755a..b7f444f 100644
--- a/core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java
+++ b/core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java
@@ -562,7 +562,7 @@ public class CalcitePrepareImpl implements CalcitePrepare {
     if (plannerFactories.isEmpty()) {
       throw new AssertionError("no planner factories");
     }
-    RuntimeException exception = new RuntimeException();
+    RuntimeException exception = Util.FoundOne.NULL;
     for (Function1<Context, RelOptPlanner> plannerFactory : plannerFactories) {
       final RelOptPlanner planner = plannerFactory.apply(context);
       if (planner == null) {