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 2014/09/06 01:56:43 UTC

[3/4] git commit: Don't load FoodMartQuerySet unless we have to. It's big.

Don't load FoodMartQuerySet unless we have to. It's big.


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

Branch: refs/heads/master
Commit: 25c6c0c74f9c335c0736b10d3f6490e15dc24eb8
Parents: b139ab8
Author: Julian Hyde <jh...@apache.org>
Authored: Fri Sep 5 13:42:33 2014 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Sep 5 13:42:33 2014 -0700

----------------------------------------------------------------------
 .../net/hydromatic/optiq/test/FoodmartTest.java | 21 +++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-optiq/blob/25c6c0c7/core/src/test/java/net/hydromatic/optiq/test/FoodmartTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/net/hydromatic/optiq/test/FoodmartTest.java b/core/src/test/java/net/hydromatic/optiq/test/FoodmartTest.java
index f4669e3..ff8432c 100644
--- a/core/src/test/java/net/hydromatic/optiq/test/FoodmartTest.java
+++ b/core/src/test/java/net/hydromatic/optiq/test/FoodmartTest.java
@@ -23,6 +23,8 @@ import org.eigenbase.util.IntegerIntervalSet;
 import com.fasterxml.jackson.core.JsonParser;
 import com.fasterxml.jackson.databind.ObjectMapper;
 
+import com.google.common.collect.ImmutableList;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -102,15 +104,24 @@ public class FoodmartTest {
 
   @Parameterized.Parameters(name = "{index}: foodmart({0})={1}")
   public static List<Object[]> getSqls() throws IOException {
-    final String idList = System.getProperty("optiq.ids");
+    String idList = System.getProperty("optiq.ids");
+    if (!OptiqAssert.ENABLE_SLOW && idList == null) {
+      // Avoid loading the query set in a regular test suite run. It burns too
+      // much memory.
+      return ImmutableList.of();
+    }
     final FoodMartQuerySet set = FoodMartQuerySet.instance();
     final List<Object[]> list = new ArrayList<Object[]>();
     if (idList != null) {
-      StringBuilder buf = new StringBuilder();
-      for (int disabledId : DISABLED_IDS) {
-        buf.append(",-").append(disabledId);
+      if (idList.endsWith(",-disabled")) {
+        StringBuilder buf = new StringBuilder(idList);
+        buf.setLength(buf.length() - ",-disabled".length());
+        for (int disabledId : DISABLED_IDS) {
+          buf.append(",-").append(disabledId);
+        }
+        idList = buf.toString();
       }
-      for (Integer id : IntegerIntervalSet.of(idList + buf)) {
+      for (Integer id : IntegerIntervalSet.of(idList)) {
         final FoodmartQuery query1 = set.queries.get(id);
         if (query1 != null) {
           list.add(new Object[] {id /*, query1.sql */});