Package org.voltdb.catalog

Examples of org.voltdb.catalog.Table


     * testGenerateTableOrder
     */
    public void testGenerateTableOrder() throws Exception {
        // Insert an artificial edge between SUBSCRIBER and ACCESS_INFO with a
        // high weight so that we can anticipate the ordering
        Table expected[] = {
            this.getTable(TM1Constants.TABLENAME_SUBSCRIBER),
            this.getTable(TM1Constants.TABLENAME_ACCESS_INFO),
            this.getTable(TM1Constants.TABLENAME_SPECIAL_FACILITY),
            this.getTable(TM1Constants.TABLENAME_CALL_FORWARDING),
        };
View Full Code Here


     * testGenerateTableOrderMissingVertex
     */
    public void testGenerateTableOrderMissingVertex() throws Exception {
        // Remove one of the vertices from the graph and make sure that it's not included
        // in our search table order
        Table catalog_tbl = this.getTable(TM1Constants.TABLENAME_SPECIAL_FACILITY);
        DesignerVertex v = agraph.getVertex(catalog_tbl);
        assertNotNull(v);
        boolean ret = agraph.removeVertex(v);
        assert(ret);
        int expected = catalog_db.getTables().size()-catalogContext.getSysTables().size()-1;
View Full Code Here

     */
    public void testGenerateColumnOrder() throws Exception {
        AccessGraph agraph = this.partitioner.generateAccessGraph();
        assertNotNull(agraph);

        Table catalog_tbl = this.getTable(TM1Constants.TABLENAME_SUBSCRIBER);
        Column expected[] = {
            this.getColumn(catalog_tbl, "S_ID"),
            this.getColumn(catalog_tbl, "SUB_NBR"),
            this.getColumn(catalog_tbl, "VLR_LOCATION"),
            this.getColumn(catalog_tbl, "BIT_1"),
View Full Code Here

    public void testInitializeVerticalPartitioning() throws Exception {
        hints.enable_vertical_partitioning = true;
        cp = new ConstraintPropagator(info, hints, agraph);
       
        // Check that a vertical partition candidate column for SUBSCRIBER
        Table catalog_tbl = this.getTable(TM1Constants.TABLENAME_SUBSCRIBER);
        DesignerVertex v = agraph.getVertex(catalog_tbl);
        assertNotNull(v);
        Collection<VerticalPartitionColumn> vp_columns = new HashSet<VerticalPartitionColumn>();
        for (Collection<Column> catalog_cols : cp.getEdgeColumns(v).values()) {
            for (Column catalog_col : catalog_cols) {
View Full Code Here

    public void testInitializeMultiAttribute() throws Exception {
        hints.enable_multi_partitioning = true;
        cp = new ConstraintPropagator(info, hints, agraph);
       
        // Check that we have multi-attribute candidates for ACCESS_INFO
        Table catalog_tbl = this.getTable(TM1Constants.TABLENAME_ACCESS_INFO);
        DesignerVertex v = agraph.getVertex(catalog_tbl);
        assertNotNull(v);
        Collection<MultiColumn> multi_columns = new HashSet<MultiColumn>();
        for (Collection<Column> catalog_cols : cp.getEdgeColumns(v).values()) {
            for (Column catalog_col : catalog_cols) {
View Full Code Here

   
    /**
     * testUpdateTwice
     */
    public void testUpdateTwice() throws Exception {
        Table catalog_tbl = this.getTable(TM1Constants.TABLENAME_SUBSCRIBER);
        cp.update(catalog_tbl);
        try {
            cp.update(catalog_tbl);
        } catch (AssertionError ex) {
            return;
View Full Code Here

     * testUpdateTable
     */
    public void testUpdateTable() throws Exception {
        Set<Table> targets = new HashSet<Table>();
        for (String table_name : new String[]{ TM1Constants.TABLENAME_SUBSCRIBER, TM1Constants.TABLENAME_ACCESS_INFO }) {
            Table catalog_tbl = this.getTable(table_name);
            cp.update(catalog_tbl);
            targets.add(catalog_tbl);   
        } // FOR
       
        // Make sure that the columns that remain for the edges to our target tables
        // are only connected through the column that the target tables were partitioned on
        Collection<Column> columns;
        for (Table catalog_tbl : catalog_db.getTables()) {
            if (targets.contains(catalog_tbl) || catalog_tbl.getSystable()) continue;
            DesignerVertex v0 = agraph.getVertex(catalog_tbl);
           
            try {
                columns = cp.getCandidateValues(catalog_tbl, Column.class);
            } catch (IllegalArgumentException ex) {
                continue;
            }
            assertNotNull(columns);
            assertFalse(columns.isEmpty());
           
            System.err.println(String.format("Examining %d columns for %s", columns.size(), catalog_tbl));
           
            // For each column that is still available for this table, check to make sure that:
            //  (1) It does not have an unmarked edge to one of our target tables
            //  (2) If it is does have an edge to one of target tables then that edge uses the column that the table is partitioned on
            for (Column catalog_col : columns) {
                if (catalog_col instanceof ReplicatedColumn) continue;
                Collection<DesignerEdge> edges = agraph.findEdgeSet(v0, catalog_col);
                assertNotNull(catalog_col.fullName(), edges);
                assertFalse(catalog_col.fullName(), edges.isEmpty());
               
                for (DesignerEdge e : edges) {
                    if (cp.isMarked(e)) continue;
                   
                    DesignerVertex v1 = agraph.getOpposite(v0, e);
                    assertNotNull(e.toString(), v1);
                    Table other_tbl = v1.getCatalogItem();
                    assertNotNull(other_tbl);

                    // Skip if not one of our target tables
                    if (targets.contains(other_tbl) == false || other_tbl.getPartitioncolumn() == null) continue;
                   
                    // Get the ColumnSet, which should only have one entry
                    PredicatePairs cset = e.getAttribute(EdgeAttributes.COLUMNSET);
                    assertNotNull(cset);
                    assertEquals(cset.toString(), 1, cset.size());
                    CatalogPair entry = cset.get(0);
                    assertNotNull(entry);
                   
                    // Get the element from the entry that is not our column
                    CatalogType other = entry.getOther(catalog_col);
                    assertNotNull(other);
                    if ((other instanceof Column) == false) continue;
                    Column other_col = (Column)other;
                    System.err.println(String.format("catalog_col=%s, other_tbl=%s, other_col=%s",
                                                     catalog_col.fullName(), other_tbl.fullName(), other_col.fullName()));
                    assertEquals(e.toString(), other_tbl, other_col.getParent());
                   
                    // Make sure that the table's partitioning column matches 
                    assertEquals(String.format("%s<-->%s\n%s", catalog_tbl, other_tbl, e.toString()), other_tbl.getPartitioncolumn(), other_col);
                } // FOR (Edge)
            } // FOR (Column)
        } // FOR
    }
View Full Code Here

public void testUpdateTableVerticalPartitioning() throws Exception {
     hints.enable_vertical_partitioning = true;
     cp = new ConstraintPropagator(info, hints, agraph);
    
     // We're going to mark SUBSCRIBER as partitioned on S_ID and get the candidates for ACCESS_INFO 
     Table catalog_tbl0 = this.getTable(TM1Constants.TABLENAME_SUBSCRIBER);
     Column catalog_col = this.getColumn(catalog_tbl0, "S_ID");
     catalog_tbl0.setPartitioncolumn(catalog_col);
     cp.update(catalog_tbl0);
     Table catalog_tbl1 = this.getTable(TM1Constants.TABLENAME_ACCESS_INFO);
     Collection<Column> expected_cols = cp.getCandidateValues(catalog_tbl1, Column.class);
     assertNotNull(expected_cols);
     assertFalse(expected_cols.isEmpty());
    
     // Get the VerticalPartitionColumn that uses S_ID as the horizontal partitioning Column
View Full Code Here

                continue;
            }
        } // FOR
       
        // Get the list of columns that we can use for CALL_FORWARDING
        Table catalog_tbl0 = this.getTable(TM1Constants.TABLENAME_CALL_FORWARDING);
        Collection<Column> orig_columns = new HashSet<Column>((Collection<Column>)cp.getCandidateValues(catalog_tbl0, Column.class));
        assertFalse(catalog_tbl0.toString(), orig_columns.isEmpty());
       
        // Reset both ACCESS_INFO and CALL_FORWARDING
        // This should give us more possible columns for CALL_FORWARDING
        Table catalog_tbl1 = this.getTable(TM1Constants.TABLENAME_ACCESS_INFO);
        cp.reset(catalog_tbl0);
        cp.reset(catalog_tbl1);
       
        // Then grab the list of colunms for ORDERS again. It should be larger than our original list
        // And the original list should be a subset
View Full Code Here

   
    /**
     * testResetTwice
     */
    public void testResetTwice() throws Exception {
        Table catalog_tbl = this.getTable(TM1Constants.TABLENAME_SUBSCRIBER);
        cp.update(catalog_tbl);
        cp.reset(catalog_tbl);
        try {
            cp.reset(catalog_tbl);
        } catch (AssertionError ex) {
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.