Package org.voltdb.compiler

Examples of org.voltdb.compiler.CatalogBuilder


    Catalog getExportCatalogForTable(String tableName, String catname, VoltTable t) throws IOException {
        return getCatalogForTable(tableName, catname, t, true);
    }

    private Catalog getCatalogForTable(String tableName, String catname, VoltTable t, boolean export) throws IOException {
        CatalogBuilder builder = new CatalogBuilder();
        builder.addLiteralSchema(TableHelper.ddlForTable(t));
        if (export) {
            builder.addLiteralSchema("EXPORT TABLE " + TableHelper.getTableName(t) + ";");
        }

        String testDir = BuildDirectoryUtils.getBuildDirectoryPath();
        builder.compile(testDir + File.separator + "test-" + catname + ".jar");
        Catalog cat = catalogForJar(testDir + File.separator + "test-" + catname + ".jar");
        return cat;
    }
View Full Code Here


    @Override
    public void setUp()
    {
        try {
            CatalogBuilder catBuilder = new CatalogBuilder();
            catBuilder.addSchema(getClass().getResource("clientfeatures.sql"));
            catBuilder.addProcedures(ArbitraryDurationProc.class);

            boolean success = catBuilder.compile(Configuration.getPathToCatalogForTest("timeouts.jar"));
            assert(success);

            depBuilder = new DeploymentBuilder(1, 1, 0);
            depBuilder.writeXML(Configuration.getPathToCatalogForTest("timeouts.xml"));
View Full Code Here

        // - Both features are pro only
        //

        if (MiscUtils.isPro()) {
            // build a catalog with a ton of indexes so catalog update will be slow
            CatalogBuilder builder = new CatalogBuilder();
            builder.addSchema(getClass().getResource("clientfeatures-wellindexed.sql"));
            builder.addProcedures(ArbitraryDurationProc.class);
            byte[] catalogToUpdate = builder.compileToBytes();
            assert(catalogToUpdate != null);

            // make a copy of the table from ddl for loading
            // (shouldn't have to do this, but for now, the table loader requires
            //  a VoltTable, and can't read schema. Could fix by using this VoltTable
View Full Code Here

    /**
     * Assuming given table has schema metadata, make a catalog containing
     * that table on disk.
     */
    String catalogPathForTable(VoltTable t, String jarname) throws IOException {
        CatalogBuilder builder = new CatalogBuilder();
        String ddl = TableHelper.ddlForTable(t);
        builder.addLiteralSchema(ddl);
        String retval = Configuration.getPathToCatalogForTest(jarname);
        boolean success = builder.compile(retval);
        // good spot below for a breakpoint if compiling fails
        if (!success) {
            fail();
        }
        return retval;
View Full Code Here

    /**
     * Perform a schema change to a mutated version of the current table (80%) or
     * to a new table entirely (20%, drops and adds the new table).
     */
    private Pair<VoltTable,TableHelper.ViewRep> catalogChange(VoltTable t1, boolean newTable, TableHelper.ViewRep view) throws Exception {
        CatalogBuilder builder = new CatalogBuilder();
        VoltTable t2 = null;
        String currentName = t1 == null ? "B" : TableHelper.getTableName(t1);
        String newName = currentName;

        // add an empty table with the schema version number in it
        VoltTable versionT = TableHelper.quickTable(String.format("V%s (BIGINT)", schemaVersionNo + 1));

        if (newTable) {
            newName = currentName.equals("A") ? "B" : "A";
            t2 = TableHelper.getTotallyRandomTable(newName, rand, false);
        }
        else {
            t2 = TableHelper.mutateTable(t1, true, rand);
        }

        log.info(_F("New Schema:\n%s", TableHelper.ddlForTable(t2)));

        // handle views
        if (view == null) {
            view = TableHelper.ViewRep.viewRepForTable("MV", t2, rand);
        }
        else {
            if (!view.compatibleWithTable(t2)) {
                view = null;
            }
        }
        if (view != null) {
            log.info(_F("New View:\n%s", view.ddlForView()));
        }
        else {
            log.info("New View: NULL");
        }

        builder.addLiteralSchema(TableHelper.ddlForTable(t2));
        if (view != null) {
            builder.addLiteralSchema(view.ddlForView());
        }
        builder.addLiteralSchema(TableHelper.ddlForTable(versionT));
        // make tables name A partitioned and tables named B replicated
        if (newName.equalsIgnoreCase("A")) {
            int pkeyIndex = TableHelper.getBigintPrimaryKeyIndexIfExists(t2);
            builder.addPartitionInfo(newName, t2.getColumnName(pkeyIndex));
            builder.addProcedures(VerifySchemaChangedA.class);
        }
        else {
            builder.addProcedures(VerifySchemaChangedB.class);
        }
        byte[] catalogData = builder.compileToBytes();
        assert(catalogData != null);

        long count = tupleCount(t1);
        long start = System.nanoTime();

View Full Code Here

TOP

Related Classes of org.voltdb.compiler.CatalogBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.