Package org.voltdb.catalog

Examples of org.voltdb.catalog.Table


            m_predicate = AbstractExpression.fromJSONObject(predicateObject, db);
        }
       
        m_targetTableName = obj.getString(Members.TARGET_TABLE_NAME.name());
        if (db != null || m_targetTableName.equals("")) {
            Table table = db.getTables().get(m_targetTableName);
            if (table == null)
                throw new JSONException("Unable to retrieve catalog object for table '" + m_targetTableName + "'");
        }
    }
View Full Code Here


        return PlanNodeType.SEQSCAN;
    }

    @Override
    public boolean computeEstimatesRecursively(PlanStatistics stats, Cluster cluster, Database db, DatabaseEstimates estimates, ScalarValueHints[] paramHints) {
        Table target = db.getTables().getIgnoreCase(m_targetTableName);
        assert(target != null);
        DatabaseEstimates.TableEstimates tableEstimates = estimates.getEstimatesForTable(target.getTypeName());
        stats.incrementStatistic(0, StatsField.TUPLES_READ, tableEstimates.maxTuples);
        m_estimatedOutputTupleCount = tableEstimates.maxTuples;
        return true;
    }
View Full Code Here

        return m_searchkeyExpressions;
    }

    @Override
    public boolean computeEstimatesRecursively(PlanStatistics stats, Cluster cluster, Database db, DatabaseEstimates estimates, ScalarValueHints[] paramHints) {
        Table target = db.getTables().getIgnoreCase(m_targetTableName);
        assert(target != null);
        DatabaseEstimates.TableEstimates tableEstimates = estimates.getEstimatesForTable(target.getTypeName());
        stats.incrementStatistic(0, StatsField.TREE_INDEX_LEVELS_TRAVERSED, (long)(Math.log(tableEstimates.maxTuples)));
        stats.incrementStatistic(0, StatsField.TUPLES_READ, 1);
        m_estimatedOutputTupleCount = 1;
        return true;
    }
View Full Code Here

        // table and then execute a second query that will read from that table. The
        // second query should get the new value from the first query and not the
        // original value.
        Client client = this.getClient();
        CatalogContext catalogContext = this.getCatalogContext();
        Table catalog_tbl = catalogContext.getTableByName(TPCCConstants.TABLENAME_ITEM);
        assertTrue(catalog_tbl.getIsreplicated());
        int expectedNumItems = 10;
        VoltTable vt = CatalogUtil.getVoltTable(catalog_tbl);
        for (int i = 0; i < expectedNumItems; i++) {
            Object row[] = VoltTableUtil.getRandomRow(catalog_tbl);
            row[0] = i;
View Full Code Here

    protected VoltTable loadTable_ORDER_LINE(Client client) throws IOException, ProcCallException {
        int num_partitions = this.getServerConfig().getPartitionCount();
        int num_tuples = num_partitions * 10;

        Database catalog_db = CatalogUtil.getDatabase(this.getCatalog());
        Table catalog_tbl = catalog_db.getTables().get("ORDER_LINE");
        assertNotNull(catalog_tbl);
        /*
        CREATE TABLE ORDER_LINE (
                OL_O_ID INTEGER DEFAULT '0' NOT NULL,
                OL_D_ID TINYINT DEFAULT '0' NOT NULL,
                OL_W_ID SMALLINT DEFAULT '0' NOT NULL,
                OL_NUMBER INTEGER DEFAULT '0' NOT NULL,
                OL_I_ID INTEGER DEFAULT NULL,
                OL_SUPPLY_W_ID SMALLINT DEFAULT NULL,
                OL_DELIVERY_D TIMESTAMP DEFAULT NULL,
                OL_QUANTITY INTEGER DEFAULT NULL,
                OL_AMOUNT FLOAT DEFAULT NULL,
                OL_DIST_INFO VARCHAR(32) DEFAULT NULL,
                PRIMARY KEY (OL_W_ID,OL_D_ID,OL_O_ID,OL_NUMBER),
                CONSTRAINT OL_FKEY_O FOREIGN KEY (OL_O_ID, OL_D_ID, OL_W_ID) REFERENCES ORDERS (O_ID, O_D_ID, O_W_ID),
                CONSTRAINT OL_FKEY_S FOREIGN KEY (OL_I_ID, OL_SUPPLY_W_ID) REFERENCES STOCK (S_I_ID, S_W_ID)
              );
              */
       
        Random rand = new Random(0);
        VoltTable vt = CatalogUtil.getVoltTable(catalog_tbl);
        int col_cnt = vt.getColumnCount();
        for (int i = 0; i < num_tuples; i++) {
            Object row[] = new Object[col_cnt];
            int col = 0;
            row[col++] = i;
            row[col++] = i;
            row[col++] = i;
            row[col++] = rand.nextInt(10); // OL_NUMBER
            col+=3; // disregard OL_I_ID,OL_SUPPLY_W_ID,OL_DELIVERY_D
            row[col++] = i * 2;
            row[col++] = 1.2 * i;
            row[col++] = "null message";
            assertEquals(col, 10);
            vt.addRow(row);
        } // FOR
       
        ClientResponse cr = client.callProcedure("@LoadMultipartitionTable", catalog_tbl.getName(), vt);
        assertEquals(Status.OK, cr.getStatus());
       
        return (vt);
    }
View Full Code Here

        long acctIds[] = { 1l, 2l };
        double balances[] = { 100d, 0d };
        ClientResponse cresponse;
        VoltTable results[];

        Table catalog_tbl = catalogContext.getTableByName(SmallBankConstants.TABLENAME_ACCOUNTS);
        long num_rows = RegressionSuiteUtil.getRowCount(client, catalog_tbl);
        assert(num_rows > acctIds[acctIds.length-1]);
        // System.err.println("# of Rows: " + num_rows);
       
        for (int i = 0; i < acctIds.length; i++) {
View Full Code Here

        System.err.println("==========================");
        agraph = AccessGraphGenerator.convertToSingleColumnEdges(catalog_db, agraph);

       
        // Make sure that there is at least one edge between DISTRICT and all other tables
        Table target = this.getTable("DISTRICT");
        DesignerVertex v0 = agraph.getVertex(target);
        assertNotNull(v0);
       
        String expected[] = { "ORDER_LINE", "STOCK" };
        for (String tbl_name : expected) {
            Table catalog_tbl = this.getTable(tbl_name);
            DesignerVertex v1 = agraph.getVertex(catalog_tbl);
            assertNotNull(v1);
           
            Collection<DesignerEdge> edges = agraph.findEdgeSet(v0, v1);
            assertNotNull(edges);
View Full Code Here

    public void testFindEdgeSetUsingColumn() throws Exception {
        AccessGraph agraph = new AccessGraph(catalog_db);
        new AccessGraphGenerator(this.info, this.catalog_proc).generate(agraph);
        agraph.setVerbose(true);
       
        Table catalog_tbl = this.getTable("STOCK");
        Column catalog_col = this.getColumn(catalog_tbl, "S_W_ID");
       
        DesignerVertex v = agraph.getVertex(catalog_tbl);
        assertNotNull(v);
        Collection<DesignerEdge> edges = agraph.findEdgeSet(v, catalog_col);
View Full Code Here

       
        assert(this.agraph.getVertexCount() > 0);
        assert(this.agraph.getEdgeCount() > 0);
       
        // Make sure that there is an edge between STOCK and ORDER_LINE
        Table tbl0 = this.getTable("STOCK");
        DesignerVertex v0 = this.agraph.getVertex(tbl0);
        assertNotNull(v0);
       
        Table tbl1 = this.getTable("ORDER_LINE");
        DesignerVertex v1 = this.agraph.getVertex(tbl1);
        assertNotNull(v1);
       
        DesignerEdge edge = this.agraph.findEdge(v0, v1);
        assertNotNull("No edge exists between " + tbl0 + " and " + tbl1, edge);
View Full Code Here

        this.generator.createSharedParamEdges(agraph, catalog_stmt0, catalog_stmt1, catalog_stmt0_params);
       
        // We should now have a complete graph between the following tables
        String tables[] = { "ORDER_LINE", "DISTRICT", "STOCK" };
        for (int i = 0; i < tables.length; i++) {
            Table t0 = this.getTable(tables[i]);
            DesignerVertex v0 = agraph.getVertex(t0);
            assertNotNull(v0);           
           
            for (int ii = i + 1; ii < tables.length; ii++) {
                Table t1 = this.getTable(tables[ii]);
                assertNotSame(t0, t1);
                DesignerVertex v1 = agraph.getVertex(t1);
                assertNotNull(v1);
                assertNotNull(agraph.findEdge(v0, v1));
            } // FOR
View Full Code Here

TOP

Related Classes of org.voltdb.catalog.Table

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.