Skip to content
This repository
Browse code

Fixes for AGGREGATE_WEIGHTED_AVG. This works quite nicely now. There …

…is still a problem in TPC-C for it, but for the most part I think this is fixed
  • Loading branch information...
commit e889abb8679b3941756cc7eea14fa9ba0d0fc75f 1 parent 7c7a365
Andy Pavlo authored March 21, 2012
15  src/frontend/edu/brown/optimizer/PlanOptimizerUtil.java
@@ -503,22 +503,17 @@ public static boolean updateAggregateColumns(final PlanOptimizerState state, Agg
503 503
             int new_idx = 0;
504 504
             for (Integer guid : child_node.getOutputColumnGUIDs()) {
505 505
                 PlanColumn pc = state.plannerContext.get(guid);
506  
-                if (pc.getStorage().equals(Storage.kTemporary)) {
  506
+                assert (pc != null);
  507
+                if (pc.equals(orig_pc, true, true)) {
  508
+                    if (trace.get())
  509
+                        LOG.trace(String.format("[%02d] Found non-expression PlanColumn match:\nORIG: %s\nNEW:  %s", new_idx, orig_pc, pc));
507 510
                     new_pc = pc;
508 511
                     break;
509  
-                } else {
510  
-                    assert (pc != null);
511  
-                    if (pc.equals(orig_pc, true, true)) {
512  
-                        if (trace.get())
513  
-                            LOG.trace(String.format("[%02d] Found non-expression PlanColumn match:\nORIG: %s\nNEW:  %s", new_idx, orig_pc, pc));
514  
-                        new_pc = pc;
515  
-                        break;
516  
-                    }
517 512
                 }
518 513
                 new_idx++;
519 514
             } // FOR
520 515
             if (new_pc == null) {
521  
-                LOG.error(String.format("Couldn't find %d => %s\n", new_idx, new_pc));
  516
+                LOG.error(String.format("Failed to find %d => %s\n", new_idx, new_pc));
522 517
                 LOG.error(PlanNodeUtil.debug(PlanNodeUtil.getRoot(node)));
523 518
             }
524 519
             assert (new_pc != null);
9  tests/frontend/org/voltdb/regressionsuites/TestFixedSQLSuite.java
@@ -1004,11 +1004,10 @@ public TestFixedSQLSuite(String name) {
1004 1004
         builder.addServerConfig(config);*/
1005 1005
 
1006 1006
         // CLUSTER!
1007  
-        // 2012-03-16 - DISABLED UNTIL WE GET A BETTER BUILD AND TEST SERVER
1008  
-//        config = new LocalCluster("fixedsql-cluster.jar", 2, 2,
1009  
-//                                  1, BackendTarget.NATIVE_EE_JNI);
1010  
-//        config.compile(project);
1011  
-//        builder.addServerConfig(config);
  1007
+        config = new LocalCluster("fixedsql-cluster.jar", 2, 2,
  1008
+                                  1, BackendTarget.NATIVE_EE_JNI);
  1009
+        config.compile(project);
  1010
+        builder.addServerConfig(config);
1012 1011
 
1013 1012
         return builder;
1014 1013
     }
17  tests/frontend/org/voltdb/regressionsuites/TestMultiPartitionSuite.java
@@ -219,20 +219,17 @@ static public Test suite() {
219 219
         /////////////////////////////////////////////////////////////
220 220
 
221 221
         // get a server config that similar, but doesn't use the same backend
222  
-        config = new LocalSingleProcessServer("distregression-hsql.jar", 1, BackendTarget.HSQLDB_BACKEND);
223  
-
  222
+//        config = new LocalSingleProcessServer("distregression-hsql.jar", 1, BackendTarget.HSQLDB_BACKEND);
224 223
         // build the jarfile (note the reuse of the TPCC project)
225  
-        config.compile(project);
226  
-
  224
+//        config.compile(project);
227 225
         // add this config to the set of tests to run
228  
-        builder.addServerConfig(config);
  226
+//        builder.addServerConfig(config);
229 227
 
230 228
         // Cluster
231  
-        // 2012-03-16 - DISABLED UNTIL WE GET A BETTER BUILD AND TEST SERVER
232  
-//        config = new LocalCluster("distregression-cluster.jar", 2, 2,
233  
-//                                  1, BackendTarget.NATIVE_EE_JNI);
234  
-//        config.compile(project);
235  
-//        builder.addServerConfig(config);
  229
+        config = new LocalCluster("distregression-cluster.jar", 2, 2,
  230
+                                  1, BackendTarget.NATIVE_EE_JNI);
  231
+        config.compile(project);
  232
+        builder.addServerConfig(config);
236 233
 
237 234
         return builder;
238 235
     }
38  ...n/optimizer/TestPlanOptimizerRegressionSuite.java → ...ltdb/regressionsuites/TestPlanOptimizerSuite.java
... ...
@@ -1,4 +1,4 @@
1  
-package edu.brown.optimizer;
  1
+package org.voltdb.regressionsuites;
2 2
 
3 3
 import java.io.IOException;
4 4
 import java.util.ArrayList;
@@ -17,6 +17,7 @@
17 17
 import org.voltdb.client.ClientResponse;
18 18
 import org.voltdb.client.ProcCallException;
19 19
 import org.voltdb.compiler.VoltProjectBuilder;
  20
+import org.voltdb.regressionsuites.LocalCluster;
20 21
 import org.voltdb.regressionsuites.LocalSingleProcessServer;
21 22
 import org.voltdb.regressionsuites.MultiConfigSuiteBuilder;
22 23
 import org.voltdb.regressionsuites.RegressionSuite;
@@ -24,9 +25,16 @@
24 25
 
25 26
 import edu.brown.catalog.CatalogUtil;
26 27
 import edu.brown.hstore.Hstoreservice.Status;
  28
+import edu.brown.optimizer.BasePlanOptimizerTestCase;
27 29
 import edu.brown.utils.StringUtil;
28 30
 
29  
-public class TestPlanOptimizerRegressionSuite extends RegressionSuite {
  31
+/**
  32
+ * Special test cases for checking complex operations in the PlanOptimizer
  33
+ * @author pavlo
  34
+ */
  35
+public class TestPlanOptimizerSuite extends RegressionSuite {
  36
+    
  37
+    private static final String PREFIX = "planopt";
30 38
 
31 39
     @Test
32 40
     public void testSingleAggregate() throws IOException, ProcCallException {
@@ -106,14 +114,16 @@ public void testMultipleAggregates() throws IOException, ProcCallException {
106 114
         Map<Integer, List<Double>> expectedValues = new HashMap<Integer, List<Double>>();
107 115
         for (Integer c_b_a_id : values.keySet()) {
108 116
             for (List<Integer> vals : values.get(c_b_a_id)) {
109  
-                if (expectedValues.containsKey(c_b_a_id) == false) {
110  
-                    expectedValues.put(c_b_a_id, new ArrayList<Double>());
  117
+                List<Double> colValues = expectedValues.get(c_b_a_id); 
  118
+                if (colValues == null) {
  119
+                    colValues = new ArrayList<Double>();
  120
+                    expectedValues.put(c_b_a_id, colValues);
111 121
                 }
112 122
                 int total = 0;
113 123
                 for (Integer val : vals) {
114 124
                     total += val.intValue();
115 125
                 } // FOR
116  
-                expectedValues.get(c_b_a_id).add(total / (double)values.get(c_b_a_id).size());
  126
+                colValues.add(total / (double)vals.size());
117 127
             } // FOR
118 128
         } // FOR
119 129
         
@@ -124,7 +134,7 @@ public void testMultipleAggregates() throws IOException, ProcCallException {
124 134
         assertNotNull(result);
125 135
         System.err.println(result);
126 136
         
127  
-        int query_offsets[] = { 4, 5 };
  137
+        int query_offsets[] = { 3, 4 };
128 138
         int expected_offsets[] = { 3, 4 };
129 139
         while (result.advanceRow()) {
130 140
             Integer c_b_a_id = Integer.valueOf((int)result.getLong(0));
@@ -132,7 +142,7 @@ public void testMultipleAggregates() throws IOException, ProcCallException {
132 142
                 double actual = result.getDouble(query_offsets[i]);
133 143
                 Double expected = expectedValues.get(c_b_a_id).get(expected_offsets[i]);
134 144
                 assertNotNull(c_b_a_id.toString(), expected);
135  
-                System.err.printf("EXPECTED[%d] => %.1f\n", c_b_a_id, expected);
  145
+                System.err.printf("[%d] => EXPECTED:%.1f / ACTUAL:%.1f\n", c_b_a_id, expected, actual);
136 146
                 assertEquals(c_b_a_id.toString(), expected.doubleValue(), actual, 0.1);
137 147
             } // FOR
138 148
         } // WHILE
@@ -173,13 +183,13 @@ protected VoltTable loadTable(Client client) throws IOException, ProcCallExcepti
173 183
      * JUnit / RegressionSuite Boilerplate Constructor
174 184
      * @param name The name of this test suite
175 185
      */
176  
-    public TestPlanOptimizerRegressionSuite(String name) {
  186
+    public TestPlanOptimizerSuite(String name) {
177 187
         super(name);
178 188
     }
179 189
  
180 190
     static public junit.framework.Test suite() {
181  
-        MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestPlanOptimizerRegressionSuite.class);
182  
-        VoltProjectBuilder project = new BasePlanOptimizerTestCase.PlanOptimizerTestProjectBuilder("planoptreg");
  191
+        MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestPlanOptimizerSuite.class);
  192
+        VoltProjectBuilder project = new BasePlanOptimizerTestCase.PlanOptimizerTestProjectBuilder(PREFIX);
183 193
         VoltServerConfig config = null;
184 194
  
185 195
         // Single Statement Procedures
@@ -193,15 +203,15 @@ public TestPlanOptimizerRegressionSuite(String name) {
193 203
  
194 204
         // CLUSTER CONFIG #1
195 205
         // One site with four partitions running in this JVM
196  
-        config = new LocalSingleProcessServer("planoptreg-twoPart.jar", 4, BackendTarget.NATIVE_EE_JNI);
  206
+        config = new LocalSingleProcessServer(PREFIX + "-twoPart.jar", 4, BackendTarget.NATIVE_EE_JNI);
197 207
         config.compile(project);
198 208
         builder.addServerConfig(config);
199 209
  
200 210
         // CLUSTER CONFIG #2
201 211
         // Two sites, each with two partitions running in separate JVMs
202  
-//        config = new LocalCluster("planoptreg-twoSiteTwoPart.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI);
203  
-//        config.compile(project);
204  
-//        builder.addServerConfig(config);
  212
+        config = new LocalCluster(PREFIX + "-twoSiteTwoPart.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI);
  213
+        config.compile(project);
  214
+        builder.addServerConfig(config);
205 215
  
206 216
         return builder;
207 217
     }
9  tests/frontend/org/voltdb/regressionsuites/TestSQLFeaturesSuite.java
@@ -333,11 +333,10 @@ static public Test suite() {
333 333
         // CONFIG #4: Local Cluster (of processes)
334 334
         /////////////////////////////////////////////////////////////
335 335
 
336  
-        // 2012-03-16 - DISABLED UNTIL WE GET A BETTER BUILD AND TEST SERVER
337  
-//        config = new LocalCluster("sqlfeatures-cluster.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI);
338  
-//        success = config.compile(project);
339  
-//        assert(success);
340  
-//        builder.addServerConfig(config);
  336
+        config = new LocalCluster("sqlfeatures-cluster.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI);
  337
+        success = config.compile(project);
  338
+        assert(success);
  339
+        builder.addServerConfig(config);
341 340
 
342 341
         return builder;
343 342
     }
7  tests/frontend/org/voltdb/regressionsuites/TestSQLTypesSuite.java
@@ -1092,10 +1092,9 @@ public TestSQLTypesSuite(final String name) {
1092 1092
         builder.addServerConfig(config);
1093 1093
 
1094 1094
         // CLUSTER?
1095  
-        // 2012-03-16 - DISABLED UNTIL WE GET A BETTER BUILD AND TEST SERVER
1096  
-//        config = new LocalCluster("sqltypes-cluster.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI);
1097  
-//        config.compile(project);
1098  
-//        builder.addServerConfig(config);
  1095
+        config = new LocalCluster("sqltypes-cluster.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI);
  1096
+        config.compile(project);
  1097
+        builder.addServerConfig(config);
1099 1098
 
1100 1099
         return builder;
1101 1100
     }
9  tests/frontend/org/voltdb/regressionsuites/TestTPCCSuite.java
@@ -820,11 +820,10 @@ static public Test suite() {
820 820
         // CONFIG #2: cluster of 2 nodes running 2 site each, one replica
821 821
         ////////////////////////////////////////////////////////////
822 822
         
823  
-        // 2012-03-16 - DISABLED UNTIL WE GET A BETTER BUILD AND TEST SERVER
824  
-//        config = new LocalCluster("tpcc-cluster.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI);
825  
-//        success = config.compile(project);
826  
-//        assert(success);
827  
-//        builder.addServerConfig(config);
  823
+        config = new LocalCluster("tpcc-cluster.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI);
  824
+        success = config.compile(project);
  825
+        assert(success);
  826
+        builder.addServerConfig(config);
828 827
 
829 828
         return builder;
830 829
     }

0 notes on commit e889abb

Please sign in to comment.
Something went wrong with that request. Please try again.