Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
15 src/frontend/edu/brown/optimizer/PlanOptimizerUtil.java
View
@@ -503,22 +503,17 @@ public static boolean updateAggregateColumns(final PlanOptimizerState state, Agg
int new_idx = 0;
for (Integer guid : child_node.getOutputColumnGUIDs()) {
PlanColumn pc = state.plannerContext.get(guid);
- if (pc.getStorage().equals(Storage.kTemporary)) {
+ assert (pc != null);
+ if (pc.equals(orig_pc, true, true)) {
+ if (trace.get())
+ LOG.trace(String.format("[%02d] Found non-expression PlanColumn match:\nORIG: %s\nNEW: %s", new_idx, orig_pc, pc));
new_pc = pc;
break;
- } else {
- assert (pc != null);
- if (pc.equals(orig_pc, true, true)) {
- if (trace.get())
- LOG.trace(String.format("[%02d] Found non-expression PlanColumn match:\nORIG: %s\nNEW: %s", new_idx, orig_pc, pc));
- new_pc = pc;
- break;
- }
}
new_idx++;
} // FOR
if (new_pc == null) {
- LOG.error(String.format("Couldn't find %d => %s\n", new_idx, new_pc));
+ LOG.error(String.format("Failed to find %d => %s\n", new_idx, new_pc));
LOG.error(PlanNodeUtil.debug(PlanNodeUtil.getRoot(node)));
}
assert (new_pc != null);
9 tests/frontend/org/voltdb/regressionsuites/TestFixedSQLSuite.java
View
@@ -1004,11 +1004,10 @@ public TestFixedSQLSuite(String name) {
builder.addServerConfig(config);*/
// CLUSTER!
- // 2012-03-16 - DISABLED UNTIL WE GET A BETTER BUILD AND TEST SERVER
-// config = new LocalCluster("fixedsql-cluster.jar", 2, 2,
-// 1, BackendTarget.NATIVE_EE_JNI);
-// config.compile(project);
-// builder.addServerConfig(config);
+ config = new LocalCluster("fixedsql-cluster.jar", 2, 2,
+ 1, BackendTarget.NATIVE_EE_JNI);
+ config.compile(project);
+ builder.addServerConfig(config);
return builder;
}
17 tests/frontend/org/voltdb/regressionsuites/TestMultiPartitionSuite.java
View
@@ -219,20 +219,17 @@ static public Test suite() {
/////////////////////////////////////////////////////////////
// get a server config that similar, but doesn't use the same backend
- config = new LocalSingleProcessServer("distregression-hsql.jar", 1, BackendTarget.HSQLDB_BACKEND);
-
+// config = new LocalSingleProcessServer("distregression-hsql.jar", 1, BackendTarget.HSQLDB_BACKEND);
// build the jarfile (note the reuse of the TPCC project)
- config.compile(project);
-
+// config.compile(project);
// add this config to the set of tests to run
- builder.addServerConfig(config);
+// builder.addServerConfig(config);
// Cluster
- // 2012-03-16 - DISABLED UNTIL WE GET A BETTER BUILD AND TEST SERVER
-// config = new LocalCluster("distregression-cluster.jar", 2, 2,
-// 1, BackendTarget.NATIVE_EE_JNI);
-// config.compile(project);
-// builder.addServerConfig(config);
+ config = new LocalCluster("distregression-cluster.jar", 2, 2,
+ 1, BackendTarget.NATIVE_EE_JNI);
+ config.compile(project);
+ builder.addServerConfig(config);
return builder;
}
38 ...n/optimizer/TestPlanOptimizerRegressionSuite.java → ...ltdb/regressionsuites/TestPlanOptimizerSuite.java
View
@@ -1,4 +1,4 @@
-package edu.brown.optimizer;
+package org.voltdb.regressionsuites;
import java.io.IOException;
import java.util.ArrayList;
@@ -17,6 +17,7 @@
import org.voltdb.client.ClientResponse;
import org.voltdb.client.ProcCallException;
import org.voltdb.compiler.VoltProjectBuilder;
+import org.voltdb.regressionsuites.LocalCluster;
import org.voltdb.regressionsuites.LocalSingleProcessServer;
import org.voltdb.regressionsuites.MultiConfigSuiteBuilder;
import org.voltdb.regressionsuites.RegressionSuite;
@@ -24,9 +25,16 @@
import edu.brown.catalog.CatalogUtil;
import edu.brown.hstore.Hstoreservice.Status;
+import edu.brown.optimizer.BasePlanOptimizerTestCase;
import edu.brown.utils.StringUtil;
-public class TestPlanOptimizerRegressionSuite extends RegressionSuite {
+/**
+ * Special test cases for checking complex operations in the PlanOptimizer
+ * @author pavlo
+ */
+public class TestPlanOptimizerSuite extends RegressionSuite {
+
+ private static final String PREFIX = "planopt";
@Test
public void testSingleAggregate() throws IOException, ProcCallException {
@@ -106,14 +114,16 @@ public void testMultipleAggregates() throws IOException, ProcCallException {
Map<Integer, List<Double>> expectedValues = new HashMap<Integer, List<Double>>();
for (Integer c_b_a_id : values.keySet()) {
for (List<Integer> vals : values.get(c_b_a_id)) {
- if (expectedValues.containsKey(c_b_a_id) == false) {
- expectedValues.put(c_b_a_id, new ArrayList<Double>());
+ List<Double> colValues = expectedValues.get(c_b_a_id);
+ if (colValues == null) {
+ colValues = new ArrayList<Double>();
+ expectedValues.put(c_b_a_id, colValues);
}
int total = 0;
for (Integer val : vals) {
total += val.intValue();
} // FOR
- expectedValues.get(c_b_a_id).add(total / (double)values.get(c_b_a_id).size());
+ colValues.add(total / (double)vals.size());
} // FOR
} // FOR
@@ -124,7 +134,7 @@ public void testMultipleAggregates() throws IOException, ProcCallException {
assertNotNull(result);
System.err.println(result);
- int query_offsets[] = { 4, 5 };
+ int query_offsets[] = { 3, 4 };
int expected_offsets[] = { 3, 4 };
while (result.advanceRow()) {
Integer c_b_a_id = Integer.valueOf((int)result.getLong(0));
@@ -132,7 +142,7 @@ public void testMultipleAggregates() throws IOException, ProcCallException {
double actual = result.getDouble(query_offsets[i]);
Double expected = expectedValues.get(c_b_a_id).get(expected_offsets[i]);
assertNotNull(c_b_a_id.toString(), expected);
- System.err.printf("EXPECTED[%d] => %.1f\n", c_b_a_id, expected);
+ System.err.printf("[%d] => EXPECTED:%.1f / ACTUAL:%.1f\n", c_b_a_id, expected, actual);
assertEquals(c_b_a_id.toString(), expected.doubleValue(), actual, 0.1);
} // FOR
} // WHILE
@@ -173,13 +183,13 @@ protected VoltTable loadTable(Client client) throws IOException, ProcCallExcepti
* JUnit / RegressionSuite Boilerplate Constructor
* @param name The name of this test suite
*/
- public TestPlanOptimizerRegressionSuite(String name) {
+ public TestPlanOptimizerSuite(String name) {
super(name);
}
static public junit.framework.Test suite() {
- MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestPlanOptimizerRegressionSuite.class);
- VoltProjectBuilder project = new BasePlanOptimizerTestCase.PlanOptimizerTestProjectBuilder("planoptreg");
+ MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestPlanOptimizerSuite.class);
+ VoltProjectBuilder project = new BasePlanOptimizerTestCase.PlanOptimizerTestProjectBuilder(PREFIX);
VoltServerConfig config = null;
// Single Statement Procedures
@@ -193,15 +203,15 @@ public TestPlanOptimizerRegressionSuite(String name) {
// CLUSTER CONFIG #1
// One site with four partitions running in this JVM
- config = new LocalSingleProcessServer("planoptreg-twoPart.jar", 4, BackendTarget.NATIVE_EE_JNI);
+ config = new LocalSingleProcessServer(PREFIX + "-twoPart.jar", 4, BackendTarget.NATIVE_EE_JNI);
config.compile(project);
builder.addServerConfig(config);
// CLUSTER CONFIG #2
// Two sites, each with two partitions running in separate JVMs
-// config = new LocalCluster("planoptreg-twoSiteTwoPart.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI);
-// config.compile(project);
-// builder.addServerConfig(config);
+ config = new LocalCluster(PREFIX + "-twoSiteTwoPart.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI);
+ config.compile(project);
+ builder.addServerConfig(config);
return builder;
}
9 tests/frontend/org/voltdb/regressionsuites/TestSQLFeaturesSuite.java
View
@@ -333,11 +333,10 @@ static public Test suite() {
// CONFIG #4: Local Cluster (of processes)
/////////////////////////////////////////////////////////////
- // 2012-03-16 - DISABLED UNTIL WE GET A BETTER BUILD AND TEST SERVER
-// config = new LocalCluster("sqlfeatures-cluster.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI);
-// success = config.compile(project);
-// assert(success);
-// builder.addServerConfig(config);
+ config = new LocalCluster("sqlfeatures-cluster.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI);
+ success = config.compile(project);
+ assert(success);
+ builder.addServerConfig(config);
return builder;
}
7 tests/frontend/org/voltdb/regressionsuites/TestSQLTypesSuite.java
View
@@ -1092,10 +1092,9 @@ public TestSQLTypesSuite(final String name) {
builder.addServerConfig(config);
// CLUSTER?
- // 2012-03-16 - DISABLED UNTIL WE GET A BETTER BUILD AND TEST SERVER
-// config = new LocalCluster("sqltypes-cluster.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI);
-// config.compile(project);
-// builder.addServerConfig(config);
+ config = new LocalCluster("sqltypes-cluster.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI);
+ config.compile(project);
+ builder.addServerConfig(config);
return builder;
}
9 tests/frontend/org/voltdb/regressionsuites/TestTPCCSuite.java
View
@@ -820,11 +820,10 @@ static public Test suite() {
// CONFIG #2: cluster of 2 nodes running 2 site each, one replica
////////////////////////////////////////////////////////////
- // 2012-03-16 - DISABLED UNTIL WE GET A BETTER BUILD AND TEST SERVER
-// config = new LocalCluster("tpcc-cluster.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI);
-// success = config.compile(project);
-// assert(success);
-// builder.addServerConfig(config);
+ config = new LocalCluster("tpcc-cluster.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI);
+ success = config.compile(project);
+ assert(success);
+ builder.addServerConfig(config);
return builder;
}
Please sign in to comment.
Something went wrong with that request. Please try again.