Search in sources :

Example 56 with VoltProjectBuilder

use of org.voltdb.compiler.VoltProjectBuilder in project voltdb by VoltDB.

the class TestCatalogDiffs method testRemoveMaterializedView.

public void testRemoveMaterializedView() throws IOException {
    String testDir = BuildDirectoryUtils.getBuildDirectoryPath();
    // with a view
    VoltProjectBuilder builder = new VoltProjectBuilder();
    builder.addLiteralSchema("\nCREATE TABLE A (C1 BIGINT NOT NULL, C2 BIGINT NOT NULL);");
    builder.addLiteralSchema("\nCREATE TABLE B (C1 BIGINT NOT NULL, C2 BIGINT NOT NULL);");
    builder.addLiteralSchema("\nCREATE VIEW MATVIEW(C1, NUM) AS " + "\n    SELECT C1, COUNT(*) FROM A GROUP BY C1;");
    builder.addLiteralSchema("\nCREATE VIEW MATVIEWJOIN(C1, NUM) AS " + "\n    SELECT A.C1, COUNT(*) FROM A JOIN B ON A.C1=B.C2 GROUP BY A.C1;");
    builder.addPartitionInfo("A", "C1");
    builder.addProcedures(org.voltdb.catalog.ProcedureA.class);
    assertTrue("Failed to compile schema", builder.compile(testDir + File.separator + "remmatview1.jar"));
    Catalog catOriginal = catalogForJar(testDir + File.separator + "remmatview1.jar");
    // without a view
    builder = new VoltProjectBuilder();
    builder.addLiteralSchema("\nCREATE TABLE A (C1 BIGINT NOT NULL, C2 BIGINT NOT NULL);");
    builder.addLiteralSchema("\nCREATE TABLE B (C1 BIGINT NOT NULL, C2 BIGINT NOT NULL);");
    builder.addPartitionInfo("A", "C1");
    builder.addProcedures(org.voltdb.catalog.ProcedureA.class);
    assertTrue("Failed to compile schema", builder.compile(testDir + File.separator + "remmatview2.jar"));
    Catalog catUpdated = catalogForJar(testDir + File.separator + "remmatview2.jar");
    verifyDiff(catOriginal, catUpdated);
}
Also used : VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder)

Example 57 with VoltProjectBuilder

use of org.voltdb.compiler.VoltProjectBuilder in project voltdb by VoltDB.

the class TestCatalogDiffs method testModifyMaterializedViewDropPredicateRejected.

public void testModifyMaterializedViewDropPredicateRejected() throws IOException {
    String testDir = BuildDirectoryUtils.getBuildDirectoryPath();
    // with a view
    VoltProjectBuilder builder = new VoltProjectBuilder();
    builder.addLiteralSchema("\nCREATE TABLE A (C1 BIGINT NOT NULL, C2 BIGINT NOT NULL);");
    builder.addLiteralSchema("\nCREATE TABLE B (C1 BIGINT NOT NULL, C2 BIGINT NOT NULL);");
    builder.addLiteralSchema("\nCREATE VIEW MATVIEW(C1, NUM) AS " + "\n    SELECT C1, COUNT(*) FROM A WHERE C1 > 0 GROUP BY C1;");
    builder.addLiteralSchema("\nCREATE VIEW MATVIEWJOIN(C1, NUM) AS " + "\n    SELECT A.C1, COUNT(*) FROM A JOIN B ON A.C1=B.C2 WHERE A.C1 > 0 GROUP BY A.C1;");
    builder.addPartitionInfo("A", "C1");
    builder.addProcedures(org.voltdb.catalog.ProcedureA.class);
    assertTrue("Failed to compile schema", builder.compile(testDir + File.separator + "droppredmatview1.jar"));
    Catalog catOriginal = catalogForJar(testDir + File.separator + "droppredmatview1.jar");
    // without a view
    builder = new VoltProjectBuilder();
    builder.addLiteralSchema("\nCREATE TABLE A (C1 BIGINT NOT NULL, C2 BIGINT NOT NULL);");
    builder.addLiteralSchema("\nCREATE TABLE B (C1 BIGINT NOT NULL, C2 BIGINT NOT NULL);");
    builder.addLiteralSchema("\nCREATE VIEW MATVIEW(C1, NUM) AS " + "\n    SELECT C1, COUNT(*) FROM A GROUP BY C1;");
    builder.addLiteralSchema("\nCREATE VIEW MATVIEWJOIN(C1, NUM) AS " + "\n    SELECT A.C1, COUNT(*) FROM A JOIN B ON A.C1=B.C2 GROUP BY A.C1;");
    builder.addPartitionInfo("A", "C1");
    builder.addProcedures(org.voltdb.catalog.ProcedureA.class);
    assertTrue("Failed to compile schema", builder.compile(testDir + File.separator + "droppredmatview2.jar"));
    Catalog catUpdated = catalogForJar(testDir + File.separator + "droppredmatview2.jar");
    verifyDiffRejected(catOriginal, catUpdated);
}
Also used : VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder)

Example 58 with VoltProjectBuilder

use of org.voltdb.compiler.VoltProjectBuilder in project voltdb by VoltDB.

the class TestCatalogDiffs method testExpandUniqueNonCoveringTableIndex.

public void testExpandUniqueNonCoveringTableIndex() throws IOException {
    String testDir = BuildDirectoryUtils.getBuildDirectoryPath();
    // start with a table
    VoltProjectBuilder builder = new VoltProjectBuilder();
    builder.addLiteralSchema("\nCREATE TABLE A (C1 BIGINT NOT NULL, C2 BIGINT NOT NULL, PRIMARY KEY(C1));");
    builder.addPartitionInfo("A", "C1");
    builder.addProcedures(org.voltdb.catalog.ProcedureA.class);
    assertTrue("Failed to compile schema", builder.compile(testDir + File.separator + "testAddUniqueNonCoveringTableIndexRejected1.jar"));
    Catalog catOriginal = catalogForJar(testDir + File.separator + "testAddUniqueNonCoveringTableIndexRejected1.jar");
    // shrink the pkey index
    builder = new VoltProjectBuilder();
    builder.addLiteralSchema("\nCREATE TABLE A (C1 BIGINT NOT NULL, C2 BIGINT NOT NULL, PRIMARY KEY(C1, C2));");
    builder.addPartitionInfo("A", "C1");
    builder.addProcedures(org.voltdb.catalog.ProcedureA.class);
    assertTrue("Failed to compile schema", builder.compile(testDir + File.separator + "testAddUniqueNonCoveringTableIndexRejected2.jar"));
    Catalog catUpdated = catalogForJar(testDir + File.separator + "testAddUniqueNonCoveringTableIndexRejected2.jar");
    verifyDiff(catOriginal, catUpdated);
}
Also used : VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder)

Example 59 with VoltProjectBuilder

use of org.voltdb.compiler.VoltProjectBuilder in project voltdb by VoltDB.

the class TestCatalogDiffs method testRemoveNonUniqueIndex.

public void testRemoveNonUniqueIndex() throws IOException {
    String testDir = BuildDirectoryUtils.getBuildDirectoryPath();
    // start with a table with an index
    VoltProjectBuilder builder = new VoltProjectBuilder();
    builder.addLiteralSchema("\nCREATE TABLE A (C1 BIGINT NOT NULL, C2 BIGINT NOT NULL, PRIMARY KEY(C1));");
    builder.addLiteralSchema("\nCREATE INDEX IDX ON A(C1,C2);");
    builder.addPartitionInfo("A", "C1");
    builder.addProcedures(org.voltdb.catalog.ProcedureA.class);
    assertTrue("Failed to compile schema", builder.compile(testDir + File.separator + "testRemoveNonUniqueIndex1.jar"));
    Catalog catOriginal = catalogForJar(testDir + File.separator + "testRemoveNonUniqueIndex1.jar");
    // remove the index
    Catalog catUpdated = get2ColumnCatalogForTable("A", "testRemoveNonUniqueIndex2");
    verifyDiff(catOriginal, catUpdated);
}
Also used : VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder)

Example 60 with VoltProjectBuilder

use of org.voltdb.compiler.VoltProjectBuilder in project voltdb by VoltDB.

the class TestCatalogDiffs method testAddMaterializedView.

public void testAddMaterializedView() throws IOException {
    String testDir = BuildDirectoryUtils.getBuildDirectoryPath();
    VoltProjectBuilder builder = new VoltProjectBuilder();
    builder.addLiteralSchema("\nCREATE TABLE A (C1 BIGINT NOT NULL, C2 BIGINT NOT NULL);");
    builder.addLiteralSchema("\nCREATE TABLE B (C1 BIGINT NOT NULL, C2 BIGINT NOT NULL);");
    builder.addPartitionInfo("A", "C1");
    builder.addProcedures(org.voltdb.catalog.ProcedureA.class);
    assertTrue("Failed to compile schema", builder.compile(testDir + File.separator + "addmatview1.jar"));
    Catalog catOriginal = catalogForJar(testDir + File.separator + "addmatview1.jar");
    builder.addLiteralSchema("\nCREATE VIEW MATVIEW(C1, NUM) AS " + "\n    SELECT C1, COUNT(*) FROM A GROUP BY C1;");
    builder.addLiteralSchema("\nCREATE VIEW MATVIEWJOIN(C1, NUM) AS " + "\n    SELECT A.C1, COUNT(*) FROM A JOIN B ON A.C1=B.C2 GROUP BY A.C1;");
    assertTrue("Failed to compile schema", builder.compile(testDir + File.separator + "addmatview2.jar"));
    Catalog catUpdated = catalogForJar(testDir + File.separator + "addmatview2.jar");
    verifyDiff(catOriginal, catUpdated);
}
Also used : VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder)

Aggregations

VoltProjectBuilder (org.voltdb.compiler.VoltProjectBuilder)269 Configuration (org.voltdb.VoltDB.Configuration)89 IOException (java.io.IOException)49 Test (org.junit.Test)45 File (java.io.File)40 ProcCallException (org.voltdb.client.ProcCallException)38 ClientResponse (org.voltdb.client.ClientResponse)37 VoltDB (org.voltdb.VoltDB)22 LocalCluster (org.voltdb.regressionsuites.LocalCluster)18 Client (org.voltdb.client.Client)17 Before (org.junit.Before)14 HashMap (java.util.HashMap)13 VoltTable (org.voltdb.VoltTable)13 ServerThread (org.voltdb.ServerThread)12 InMemoryJarfile (org.voltdb.utils.InMemoryJarfile)12 VoltCompiler (org.voltdb.compiler.VoltCompiler)11 HttpResponse (org.apache.http.HttpResponse)10 BeforeClass (org.junit.BeforeClass)8 ClientConfig (org.voltdb.client.ClientConfig)7 UserInfo (org.voltdb.compiler.VoltProjectBuilder.UserInfo)7