Search in sources :

Example 16 with Database

use of org.voltdb.catalog.Database in project voltdb by VoltDB.

the class GenerateEETests method generatedCountPlan.

public void generatedCountPlan() throws Exception {
    Database db = getDatabase();
    TableConfig countInput = makeCountInput(db);
    TableConfig countOutput = makeCountOutput(db);
    DBConfig countDB = new DBConfig(getClass(), GenerateEETests.class.getResource(DDL_FILENAME), getCatalogString(), countInput, countOutput);
    String sqlStmt;
    sqlStmt = "select A, B, C, count(*) over (partition by A order by B) as R from T ORDER BY A, B, C, R;";
    countDB.addTest(new TestConfig("test_count_star", sqlStmt, false, countOutput));
    sqlStmt = "select A, B, C, count(A+B) over (partition by A order by B) as R from T ORDER BY A, B, C, R;";
    countDB.addTest(new TestConfig("test_count", sqlStmt, false, countOutput));
    generateTests("executors", "TestWindowedCount", countDB);
}
Also used : Database(org.voltdb.catalog.Database)

Example 17 with Database

use of org.voltdb.catalog.Database in project voltdb by VoltDB.

the class GenerateEETests method generatedSumPlan.

public void generatedSumPlan() throws Exception {
    Database db = getDatabase();
    TableConfig TConfig = makeTConfig(db);
    TableConfig sumOutput = makeSumOutput(db);
    DBConfig sumDB = new DBConfig(getClass(), GenerateEETests.class.getResource(DDL_FILENAME), getCatalogString(), TConfig, sumOutput);
    sumDB.addTest(new TestConfig("test_min_last_row", "select A, B, sum(B+C) over (partition by A order by B) as R from T ORDER BY A, B, R;", false, sumOutput));
    generateTests("executors", "TestWindowedSum", sumDB);
}
Also used : Database(org.voltdb.catalog.Database)

Example 18 with Database

use of org.voltdb.catalog.Database in project voltdb by VoltDB.

the class GenerateEETests method generatedMaxPlan.

public void generatedMaxPlan() throws Exception {
    Database db = getDatabase();
    TableConfig TConfig = makeTConfig(db);
    TableConfig testOutput = makeTestOutput(db);
    DBConfig maxDB = new DBConfig(getClass(), GenerateEETests.class.getResource(DDL_FILENAME), getCatalogString(), TConfig, testOutput);
    maxDB.addTest(new TestConfig("test_max_first_row", "select A, B, max(-1 * abs(1-C)) over (partition by A order by B) as R from T ORDER BY A, B, R;", false, testOutput));
    maxDB.addTest(new TestConfig("test_max_middle_row", "select A, B, max(-1 * abs(3-C)) over (partition by A order by B) as R from T ORDER BY A, B, R;", false, testOutput));
    maxDB.addTest(new TestConfig("test_max_last_row", "select A, B, max(-1 * abs(5-C)) over (partition by A order by B) as R from T ORDER BY A, B, R;", false, testOutput));
    generateTests("executors", "TestWindowedMax", maxDB);
}
Also used : Database(org.voltdb.catalog.Database)

Example 19 with Database

use of org.voltdb.catalog.Database in project voltdb by VoltDB.

the class GenerateEETests method generatedStringPlan.

public void generatedStringPlan() throws Exception {
    Database db = getDatabase();
    // We test a particular possible bug in the test framework.
    // If the found values are shorter than the expected values
    // comparing the two may cause a read to non-existent memory.
    final TableConfig CCCConfig = new TableConfig("CCC", db, new Object[][] { { 100, "alpha", "beta" } });
    final TableConfig tooLongAnswerConfig = new TableConfig("CCCLongAns", db, new Object[][] { { 100, "alphaalpha", "betabeta" } });
    final TableConfig tooShortAnswerConfig = new TableConfig("CCCShortAns", db, new Object[][] { { 100, "al", "be" } });
    DBConfig GSDB = new DBConfig(getClass(), GenerateEETests.class.getResource(DDL_FILENAME), getCatalogString(), CCCConfig, tooShortAnswerConfig, tooLongAnswerConfig);
    GSDB.addTest(new TestConfig("test_long_string", "select * from CCC;", true, tooLongAnswerConfig));
    GSDB.addTest(new TestConfig("test_short_string", "select * from CCC;", true, tooShortAnswerConfig));
    generateTests("executors", "TestGeneratedString", GSDB);
}
Also used : Database(org.voltdb.catalog.Database)

Example 20 with Database

use of org.voltdb.catalog.Database in project voltdb by VoltDB.

the class GenerateEETests method generatedPlannerTest.

public void generatedPlannerTest() throws Exception {
    //
    // First, get the database.  This is the database
    // which contains the catalog, with contains the
    // processed definitions from the DDL file.
    //
    Database db = getDatabase();
    //
    // Create some table configurations.  These are the parts of
    // the catalog we need to generate tests, cached for easy use.
    //
    // It's often more helpful to create a member function which
    // makes a table configuration, rather than creating a table
    // configuration as a static object.  This is because the
    // table configuration depends on the schema, which is in
    // the Database, and we won't have the Database until run time.
    //
    final TableConfig AAAConfig = makeAAA(db);
    final TableConfig BBBConfig = makeBBB(db);
    final TableConfig XXXConfig = makeXXX(db);
    // This is another way of making a TableConfig.  As we can see,
    // a TableConfig is given by a table name, the schema extracted from
    // the database db and some data.
    //
    final TableConfig orderByOutput = new TableConfig("test_order_by", db, new Object[][] { { 1, 10 }, { 1, 10 }, { 1, 20 }, { 1, 20 }, { 1, 30 }, { 2, 10 }, { 2, 10 }, { 2, 20 }, { 2, 20 }, { 2, 30 }, { 3, 10 }, { 3, 10 }, { 3, 20 }, { 3, 20 }, { 3, 30 } });
    final TableConfig joinOutput = new TableConfig("test_join", db, new Integer[][] { { 1, 10, 101 }, { 1, 10, 101 }, { 1, 10, 101 }, { 1, 10, 102 }, { 1, 10, 102 }, { 1, 10, 102 }, { 1, 20, 201 }, { 1, 20, 201 }, { 1, 20, 201 }, { 1, 20, 202 }, { 1, 20, 202 }, { 1, 20, 202 }, { 1, 30, 301 }, { 1, 30, 301 }, { 1, 30, 301 }, { 2, 10, 101 }, { 2, 10, 101 }, { 2, 10, 101 }, { 2, 10, 102 }, { 2, 10, 102 }, { 2, 10, 102 }, { 2, 20, 201 }, { 2, 20, 201 }, { 2, 20, 201 }, { 2, 20, 202 }, { 2, 20, 202 }, { 2, 20, 202 }, { 2, 30, 301 }, { 2, 30, 301 }, { 2, 30, 301 }, { 3, 10, 101 }, { 3, 10, 101 }, { 3, 10, 101 }, { 3, 10, 102 }, { 3, 10, 102 }, { 3, 10, 102 }, { 3, 20, 201 }, { 3, 20, 201 }, { 3, 20, 201 }, { 3, 20, 202 }, { 3, 20, 202 }, { 3, 20, 202 }, { 3, 30, 301 }, { 3, 30, 301 }, { 3, 30, 301 } });
    //
    // This a third kind of configuration creates a table whose contents
    // are generated randomly.  It will have 10000 rows, with random
    // values of the right type for each of the columns.
    //
    final TableConfig CCCConfig = new TableConfig("CCC", db, 10000);
    //
    // Create a DB config, which contains all the tables.
    // Note that input tables, like AAAConfig or BBBConfig,
    // and result tables, like orderByOutput or
    // joinOutput, need to be added.  Any number of tables
    // can be added.
    DBConfig dbc = new DBConfig(getClass(), GenerateEETests.class.getResource(DDL_FILENAME), getCatalogString(), AAAConfig, BBBConfig, CCCConfig, XXXConfig, orderByOutput, joinOutput);
    // Add a test.  This test runs the select statement
    // and expects the result to be orderByOutput.
    dbc.addTest(new TestConfig("test_order_by", "select A, B from AAA order by A, B;", false, orderByOutput));
    // Add another test.  This test runs the select
    // statement and expects the result to be joinOutput.
    dbc.addTest(new TestConfig("test_join", "select AAA.A, AAA.B, BBB.C from AAA join BBB on AAA.C = BBB.C order by AAA.A, AAA.B, AAA.C;", false, joinOutput));
    // In this case we don't care about the output
    // at all.  We just want to run the test.  This could
    // be used under gdb, where the output is long or
    // non-deterministic, or to do profiling, where we don't
    // care about specifying the output, and it will not
    // be validated at all.
    dbc.addTest(new TestConfig("test_cache", "select * from CCC;", false));
    // Now, write the tests in the file executors/TestGeneratedPlans.cpp.
    generateTests("executors", "TestGeneratedPlans", dbc);
}
Also used : Database(org.voltdb.catalog.Database)

Aggregations

Database (org.voltdb.catalog.Database)62 Table (org.voltdb.catalog.Table)22 Catalog (org.voltdb.catalog.Catalog)12 Cluster (org.voltdb.catalog.Cluster)10 File (java.io.File)9 Column (org.voltdb.catalog.Column)9 Procedure (org.voltdb.catalog.Procedure)9 IOException (java.io.IOException)5 VoltTable (org.voltdb.VoltTable)5 ArrayList (java.util.ArrayList)4 Group (org.voltdb.catalog.Group)4 Connector (org.voltdb.catalog.Connector)3 Constraint (org.voltdb.catalog.Constraint)3 Statement (org.voltdb.catalog.Statement)3 FileNotFoundException (java.io.FileNotFoundException)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 SimpleDateFormat (java.text.SimpleDateFormat)2 HashMap (java.util.HashMap)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 JAXBException (javax.xml.bind.JAXBException)2