Package com.foundationdb.ais.model

Examples of com.foundationdb.ais.model.Group


    protected static Group singleGroup(Joinable j) {
        if (j.isTable())
            return ((TableSource)j).getTable().getGroup();
        else if (j.isJoin()) {
            JoinNode join = (JoinNode)j;
            Group gl = singleGroup(join.getLeft());
            Group gr = singleGroup(join.getRight());
            if (gl == gr)
                return gl;
            else
                return null;
        }
View Full Code Here


            long ancestorCount = costEstimator.getTableRowCount(ancestor);
            tableCounts.put(ancestor,
                            // Ceiling number of ancestor needed to get limit of child.
                            (limit * ancestorCount + (childCount - 1)) / childCount);
        }
        Group group = lastRequired.getTable().getGroup();
        Map<Table,Long> moreCounts = new HashMap<>();
        for (Table table : lastRequired.getTable().getAIS().getTables().values()) {
            if (table.getGroup() == group) {
                Table commonAncestor = table;
                while (!tableCounts.containsKey(commonAncestor)) {
View Full Code Here

    }

    @Test
    public void basicCreation() throws InvalidOperationException {
        createLeftGroupIndex(groupName, "name_date", "c.name", "o.odate");
        final Group group = ddl().getAIS(session()).getGroup(groupName);
        assertEquals("group index count", 1, group.getIndexes().size());
        final GroupIndex index = group.getIndex("name_date");
        assertNotNull("name_date index exists", index);
        assertEquals("index column count", 2, index.getKeyColumns().size());
        assertEquals("name is first", "name", index.getKeyColumns().get(0).getColumn().getName());
        assertEquals("odate is second", "odate", index.getKeyColumns().get(1).getColumn().getName());
View Full Code Here

    @Test
    public void multipleCreation() throws InvalidOperationException {
        createLeftGroupIndex(groupName, "name_date", "c.name", "o.odate");
        createLeftGroupIndex(groupName, "name_sku", "c.name", "i.sku");
        final Group group = ddl().getAIS(session()).getGroup(groupName);
        assertEquals("group index count", 2, group.getIndexes().size());
    }
View Full Code Here

    public void groupedTablesWithSameNameAndColumnNames() {
        createTable("s1", "t1", "id int not null primary key");
        createTable("s2", "t1", "some_id int not null primary key, id int, grouping foreign key(id) references s1.t1(id)");
        createTable("s3", "t1", "some_id int not null primary key, id int, grouping foreign key(id) references s2.t1(some_id)");
        AkibanInformationSchema ais = ddl().getAIS(session());
        Group group = ais.getGroup(new TableName("s1", "t1"));
        assertNotNull("Found group", group);
        List<TableName> tablesInGroup = new ArrayList<>();
        for(Table table : ais.getTables().values()) {
            if(table.getGroup() == group) {
                tablesInGroup.add(table.getName());
View Full Code Here

{
    @Override
    public Operator plan()
    {
        // select id, value, $1 from test
        Group group = ais().getGroup(new TableName("test", "test"));
        Table testTable = ais().getTable("test", "test");
        RowType testRowType = schema().tableRowType(testTable);
        return
            project_Default(
                groupScan_Default(group),
View Full Code Here

                    throw e;
                }
            }
        }

        Group group = getTable(c).getGroup();
        for (GroupIndex groupIndex : group.getIndexes()) {
            checkIndex(groupIndex);
        }

        c = null;
        o = null;
View Full Code Here

        } catch (InvalidOperationException e) {
            throw new TestException(e);
        }

        AkibanInformationSchema ais = ddl().getAIS(session());
        final Group group1 = ais.getTable("s1", "t").getGroup();
        final Group group2 = ais.getTable("s2", "t").getGroup();
        if (group1.getName().equals(group2.getName())) {
            fail("same group names: " + group1 + " and " + group2);
        }

        Table s1T = ais.getTable("s1", "t");
        Table s1C = ais.getTable("s1", "c");
        Table s2T = ais.getTable("s2", "t");
        Table s2C = ais.getTable("s2", "c");

        assertEquals("s1.t root", s1T, group1.getRoot());
        assertEquals("s1.c parent", s1T, s1C.getParentJoin().getParent());
        assertEquals("s1.c join cols", "[JoinColumn(pid -> id)]", s1C.getParentJoin().getJoinColumns().toString());

        assertEquals("s2.t root", s2T, group2.getRoot());
        assertEquals("s2.c parent", s2T, s2C.getParentJoin().getParent());
        assertEquals("s2.c join cols", "[JoinColumn(pid -> id)]", s2C.getParentJoin().getJoinColumns().toString());
    }
View Full Code Here

            this.fkJoinName = fkIndexName;
            this.fkIndexPos = 0;
            this.referencesSchema = schema;
            this.referencesTable = table;

            Group oldGroup = aisb.akibanInformationSchema().getTable(this.schema, this.object).getGroup();

            aisb.index(this.schema, this.object, fkIndexName);
            aisb.joinTables(fkJoinName, schema, table, this.schema, this.object);

            TableName fkGroupName = tablesToGroups.get(TableName.create(referencesSchema, referencesTable));
            aisb.moveTreeToGroup(this.schema, this.object, fkGroupName, fkJoinName);
            aisb.akibanInformationSchema().removeGroup(oldGroup);
            TableName oldGroupName = tablesToGroups.put(TableName.create(this.schema, this.object), fkGroupName);
            assert oldGroup.getName().equals(oldGroupName) : oldGroup.getName() + " != " + oldGroupName;
            return this;
        }
View Full Code Here

    @Test
    public void testSimple() throws Exception {
        AkibanInformationSchema ais = ais(
          "CREATE TABLE t(id INT PRIMARY KEY NOT NULL, s VARCHAR(128), d DOUBLE)");
        Group g = ais.getGroup(new TableName(SCHEMA, "t"));
        RowDef tRowDef = g.getRoot().rowDef();
        ProtobufRowDataConverter converter = converter(g);
        encodeDecode(ais, converter, tRowDef,
                     1L, "Fred", 3.14);
    }
View Full Code Here

TOP

Related Classes of com.foundationdb.ais.model.Group

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.