Package com.foundationdb.ais.model

Examples of com.foundationdb.ais.model.GroupIndex


        public Index next() {
            getIndexes:
            while(tableIndexIt == null || !tableIndexIt.hasNext()) {
                while(groupIndexIt != null && groupIndexIt.hasNext()) {
                    GroupIndex index = groupIndexIt.next();
                    if(index.leafMostTable() == curTable) {
                        return index;
                    }
                }
                while(textIndexIt != null && textIndexIt.hasNext()) {
                    return textIndexIt.next();
View Full Code Here


        if(names.isEmpty()) {
            return;
        }
        List<GroupIndex> groupIndexes = new ArrayList<>();
        for(String n : names) {
            GroupIndex index = table.getGroup().getIndex(n);
            assert (index != null) : n;
            groupIndexes.add(index);
        }
        schemaManager().dropIndexes(session, groupIndexes);
    }
View Full Code Here

        List<Index> indexesToBuild = new ArrayList<>();
        Group origGroup = origTable.getGroup();
        Group tempGroup = tempAIS.getGroup(newTable.getGroup().getName());
        for(Entry<String, List<ColumnName>> entry : changeState.affectedGI.entrySet()) {
            GroupIndex origIndex = origGroup.getIndex(entry.getKey());
            GroupIndex tempIndex = GroupIndex.create(tempAIS, tempGroup, origIndex);
            int pos = 0;
            for(ColumnName cn : entry.getValue()) {
                Table tempTable = tempAIS.getTable(cn.getTableName());
                Column tempColumn = tempTable.getColumn(cn.getName());
                IndexColumn.create(tempIndex, tempColumn, pos++, true, null);
            }
            if(!changeState.dataAffectedGI.containsKey(entry.getKey())) {
                // TODO: Maybe need a way to say copy without the tree name part?
                tempIndex.copyStorageDescription(origIndex);
            }
            indexesToBuild.add(tempIndex);
        }

        schemaManager().createIndexes(session, indexesToBuild, true);
View Full Code Here

                }
            }

            Group newGroup = newTable.getGroup();
            for(String indexName : validator.getState().dataAffectedGI.keySet()) {
                GroupIndex index = newGroup.getIndex(indexName);
                if(newTable.getGroupIndexes().contains(index)) {
                    TableChanges.IndexChange.Builder builder = TableChanges.IndexChange.newBuilder();
                    builder.setIndexType(index.getIndexType().name());
                    builder.setChange(ChangeSetHelper.createModifyChange(indexName, indexName));
                    cs.addIndexChange(builder);
                }
            }
View Full Code Here

        c = createTable(SCHEMA, "c", "cid int not null primary key, name varchar(32)");
        o = createTable(SCHEMA, "o", "oid int not null primary key, c_id int", "when varchar(32)", akibanFK("c_id", "c", "cid"));
        i = createTable(SCHEMA, "i", "iid int not null primary key, o_id int", "sku varchar(6)", akibanFK("o_id", "o", "oid"));
        h = createTable(SCHEMA, "h", "hid int not null primary key, i_id int", akibanFK("i_id", "i", "iid"));
        TableName groupName = getTable(c).getGroup().getName();
        GroupIndex gi = createLeftGroupIndex(groupName, GI_NAME, "o.when", "i.sku");

        schema = new Schema(ddl().getAIS(session()));
        adapter = newStoreAdapter(schema);
        queryContext = queryContext(adapter);
        queryBindings = queryContext.createBindings();
View Full Code Here

    @Test
    public void testIndexMetadata()
    {
        // Index row: e.uid, m.lastLogin, m.profileID, e.eugid
        // HKey for eug table: [U, e.uid, M, E, e.eugid]
        GroupIndex gi = (GroupIndex) groupIndexRowType.index();
        IndexRowComposition rowComposition = gi.indexRowComposition();
        assertEquals(4, rowComposition.getFieldPosition(0));
        assertEquals(2, rowComposition.getFieldPosition(1));
        assertEquals(1, rowComposition.getFieldPosition(2));
        assertEquals(3, rowComposition.getFieldPosition(3));
    }
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());

        checkGroupIndexes(getTable("test", "c"), index);
        checkGroupIndexes(getTable("test", "o"), index);
        // and just to double check...
        assertEquals("c group", group, getTable("test", "c").getGroup());
View Full Code Here

                  row(cId, 2, "jill"),
                    row(oId, 3, 2, 20050930),
                  row(cId, 3, "foo"),
                  row(cId, 4, "bar"));

        GroupIndex oDate_cName = createLeftGroupIndex(groupName, "oDate_cName", "o.odate", "c.name");
        expectIndexContents(oDate_cName,
                            array(Object.class, null, "bar"),
                            array(Object.class, null, "foo"),
                            array(20050930L, "jill"),
                            array(20100702, "bob"),
View Full Code Here

                  row(cId, 3, "foo"),
                  row(cId, 4, "bar"),
                    row(oId, 4, 4, 20070101),
                      row(iId, 5, 4, 3456L));

        GroupIndex iSku_oDate = createLeftGroupIndex(groupName, "iSku_oDate", "i.sku", "o.odate");
        expectIndexContents(iSku_oDate,
                            array(Object.class, null, 20110621L),
                            array(1832L, 20100702L),
                            array(3456L, 20070101L),
                            array(5623L, 20100702L),
View Full Code Here

                    row(aId, 1, 2, "875"),
                  row(cId, 3, "foo"),
                  row(cId, 4, "bar"),
                    row(aId, 2, 4, "23"));

        GroupIndex aAddr_cID = createLeftGroupIndex(groupName, "aAddr_cID", "a.addr", "c.id");
        expectIndexContents(aAddr_cID,
                            array(Object.class, null, 3L),
                            array(123L, 1L),
                            array(23L, 4L),
                            array(875L, 2L));
View Full Code Here

TOP

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

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.