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/28 08:52:09 UTC

incubator-calcite git commit: [CALCITE-897] Enable debugging using "-Dcalcite.debug"

Repository: incubator-calcite
Updated Branches:
  refs/heads/master 0715f5b55 -> a1e0b0068


[CALCITE-897] Enable debugging using "-Dcalcite.debug"


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

Branch: refs/heads/master
Commit: a1e0b0068f585cfd5e2ffb2b4747d8b62c7d19df
Parents: 0715f5b
Author: Julian Hyde <jh...@apache.org>
Authored: Fri Sep 25 01:32:12 2015 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Sun Sep 27 17:09:35 2015 -0700

----------------------------------------------------------------------
 .../apache/calcite/prepare/CalcitePrepareImpl.java    |  6 ++----
 core/src/main/java/org/apache/calcite/util/Util.java  | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a1e0b006/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 2a9c3fc..f177a5c 100644
--- a/core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java
+++ b/core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java
@@ -154,12 +154,10 @@ import static org.apache.calcite.util.Static.RESOURCE;
  */
 public class CalcitePrepareImpl implements CalcitePrepare {
 
-  public static final boolean DEBUG =
-      "true".equals(System.getProperties().getProperty("calcite.debug"));
+  public static final boolean DEBUG = Util.getBooleanProperty("calcite.debug");
 
   public static final boolean COMMUTE =
-      "true".equals(
-          System.getProperties().getProperty("calcite.enable.join.commute"));
+      Util.getBooleanProperty("calcite.enable.join.commute");
 
   /** Whether to enable the collation trait. Some extra optimizations are
    * possible if enabled, but queries should work either way. At some point

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a1e0b006/core/src/main/java/org/apache/calcite/util/Util.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/Util.java b/core/src/main/java/org/apache/calcite/util/Util.java
index dbaf0a8..7091855 100644
--- a/core/src/main/java/org/apache/calcite/util/Util.java
+++ b/core/src/main/java/org/apache/calcite/util/Util.java
@@ -2176,6 +2176,20 @@ public class Util {
     }
   }
 
+  /** Returns the value of a system property as a boolean.
+   *
+   * <p>For example, the property "foo" is considered true if you supply
+   * {@code -Dfoo} or {@code -Dfoo=true} or {@code -Dfoo=TRUE},
+   * false if you omit the flag or supply {@code -Dfoo=false}.
+   *
+   * @param property Property name
+   * @return Whether property is true
+   */
+  public static boolean getBooleanProperty(String property) {
+    final String v = System.getProperties().getProperty(property);
+    return v != null && ("".equals(v) || "true".equalsIgnoreCase(v));
+  }
+
   //~ Inner Classes ----------------------------------------------------------
 
   /**